Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

66%
+2 −0
Q&A Getting a Module Error When Running Pytest Even Though the Module is Installed in the Current Virtual Environment

Hello everyone, I am encountering an issue when running pytest in my virtual environment. Although I have installed the required modules in my virtual environment using pip, I am still getting a M...

0 answers  ·  posted 10mo ago by ShadowsRanger‭  ·  edited 10mo ago by ShadowsRanger‭

Question manjaro python
#4: Post edited by user avatar ShadowsRanger‭ · 2023-07-17T10:25:49Z (10 months ago)
  • Hello everyone,
  • I am facing an issue when running pytest in my virtual environment. Even though I have installed the required modules in my virtual environment using pip, I am still getting a ModuleNotFoundError when running pytest. I had to install some packages globally using the package manager to stop seeing this errors. But this only works with popular packages since all of them aren't available on the package manager.
  • As a workaround, I had to uninstall pytest from the package manager and install it in the virtual environment. However, I would prefer to use the pytest from the package manager since it makes sense to me to install a package I use often globally instead of installing it in each virtual environment.
  • In summary I would like to install globally only pytest while all other packages are installed on the virtual environment. And I want to know how to use the global pytest from the virtual environment without getting any errors.
  • Thank you in advance for the help.
  • Here is the output of `pip freeze` in my virtual environment:
  • ```
  • venv ❯ pip freeze
  • backoff==2.2.1
  • certifi==2023.5.7
  • charset-normalizer==3.2.0
  • feedparser==6.0.10
  • idna==3.4
  • pythorhead==0.12.3
  • requests==2.31.0
  • schedule==1.2.0
  • sgmllib3k==1.0.0
  • urllib3==2.0.3
  • ```
  • And here is the error I am getting when running pytest:
  • ```
  • venv ❯ pytest my_module.py
  • E ModuleNotFoundError: No module named 'schedule'
  • ```
  • Hello everyone,
  • I am encountering an issue when running pytest in my virtual environment. Although I have installed the required modules in my virtual environment using pip, I am still getting a ModuleNotFoundError when running pytest. I had to install some packages globally using the package manager to stop seeing these errors. However, this only works with popular packages since not all of them are available on the package manager.
  • As a workaround, I had to uninstall pytest from the package manager and install it in the virtual environment. However, I would prefer to use the pytest from the package manager since it makes sense to me to install a package I use often globally instead of installing it in each virtual environment.
  • In summary, I would like to install only pytest globally while all other packages are installed in the virtual environment. And I want to know how to use the global pytest from the virtual environment without getting any errors.
  • Thank you in advance for the help.
  • Here is the output of `pip freeze` in my virtual environment:
  • ```
  • venv ❯ pip freeze
  • backoff==2.2.1
  • certifi==2023.5.7
  • charset-normalizer==3.2.0
  • feedparser==6.0.10
  • idna==3.4
  • pythorhead==0.12.3
  • requests==2.31.0
  • schedule==1.2.0
  • sgmllib3k==1.0.0
  • urllib3==2.0.3
  • ```
  • And here is the error I am getting when running pytest:
  • ```
  • venv ❯ pytest my_module.py
  • E ModuleNotFoundError: No module named 'schedule'
  • ```
#3: Post edited by user avatar ShadowsRanger‭ · 2023-07-17T10:24:21Z (10 months ago)
  • Hello everyone,
  • I am facing an issue when running pytest in my virtual environment. Even though I have installed the required modules in my virtual environment using pip, I am still getting a ModuleNotFoundError when running pytest. I had to install some packages globally using the package manager to stop seeing this errors. But this only works with popular packages since all of them aren't available on the package manager.
  • As a workaround, I had to uninstall pytest from the package manager and install it in the virtual environment. However, I would prefer to use the pytest from the package manager since it makes sense to me to install a package I use often globally instead of installing it in each virtual environment.
  • Here is the output of `pip freeze` in my virtual environment:
  • ```
  • venv ❯ pip freeze
  • backoff==2.2.1
  • certifi==2023.5.7
  • charset-normalizer==3.2.0
  • feedparser==6.0.10
  • idna==3.4
  • pythorhead==0.12.3
  • requests==2.31.0
  • schedule==1.2.0
  • sgmllib3k==1.0.0
  • urllib3==2.0.3
  • ```
  • And here is the error I am getting when running pytest:
  • ```
  • venv ❯ pytest my_module.py
  • E ModuleNotFoundError: No module named 'schedule'
  • ```
  • I would appreciate any help in resolving this issue and being able to use the pytest version from the package manager while in the virtual environment. Thank you in advance.
  • Hello everyone,
  • I am facing an issue when running pytest in my virtual environment. Even though I have installed the required modules in my virtual environment using pip, I am still getting a ModuleNotFoundError when running pytest. I had to install some packages globally using the package manager to stop seeing this errors. But this only works with popular packages since all of them aren't available on the package manager.
  • As a workaround, I had to uninstall pytest from the package manager and install it in the virtual environment. However, I would prefer to use the pytest from the package manager since it makes sense to me to install a package I use often globally instead of installing it in each virtual environment.
  • In summary I would like to install globally only pytest while all other packages are installed on the virtual environment. And I want to know how to use the global pytest from the virtual environment without getting any errors.
  • Thank you in advance for the help.
  • Here is the output of `pip freeze` in my virtual environment:
  • ```
  • venv ❯ pip freeze
  • backoff==2.2.1
  • certifi==2023.5.7
  • charset-normalizer==3.2.0
  • feedparser==6.0.10
  • idna==3.4
  • pythorhead==0.12.3
  • requests==2.31.0
  • schedule==1.2.0
  • sgmllib3k==1.0.0
  • urllib3==2.0.3
  • ```
  • And here is the error I am getting when running pytest:
  • ```
  • venv ❯ pytest my_module.py
  • E ModuleNotFoundError: No module named 'schedule'
  • ```
#2: Post edited by user avatar ShadowsRanger‭ · 2023-07-17T10:22:34Z (10 months ago)
  • Hello everyone,
  • I am facing an issue when running pytest in my virtual environment. Even though I have installed the required modules in my virtual environment using pip, I am still getting a ModuleNotFoundError when running pytest. I had to install some packages globally using the package manager, but this only works with popular packages since all of them aren't available on the package manager.
  • As a workaround, I had to uninstall pytest from the package manager and install it in the virtual environment. However, I would prefer to use the pytest from the package manager since it makes sense to me to install a package I use often globally instead of installing it in each virtual environment.
  • Here is the output of `pip freeze` in my virtual environment:
  • ```
  • venv ❯ pip freeze
  • backoff==2.2.1
  • certifi==2023.5.7
  • charset-normalizer==3.2.0
  • feedparser==6.0.10
  • idna==3.4
  • pythorhead==0.12.3
  • requests==2.31.0
  • schedule==1.2.0
  • sgmllib3k==1.0.0
  • urllib3==2.0.3
  • ```
  • And here is the error I am getting when running pytest:
  • ```
  • venv ❯ pytest my_module.py
  • E ModuleNotFoundError: No module named 'schedule'
  • ```
  • I would appreciate any help in resolving this issue and being able to use the pytest version from the package manager while in the virtual environment. Thank you in advance.
  • Hello everyone,
  • I am facing an issue when running pytest in my virtual environment. Even though I have installed the required modules in my virtual environment using pip, I am still getting a ModuleNotFoundError when running pytest. I had to install some packages globally using the package manager to stop seeing this errors. But this only works with popular packages since all of them aren't available on the package manager.
  • As a workaround, I had to uninstall pytest from the package manager and install it in the virtual environment. However, I would prefer to use the pytest from the package manager since it makes sense to me to install a package I use often globally instead of installing it in each virtual environment.
  • Here is the output of `pip freeze` in my virtual environment:
  • ```
  • venv ❯ pip freeze
  • backoff==2.2.1
  • certifi==2023.5.7
  • charset-normalizer==3.2.0
  • feedparser==6.0.10
  • idna==3.4
  • pythorhead==0.12.3
  • requests==2.31.0
  • schedule==1.2.0
  • sgmllib3k==1.0.0
  • urllib3==2.0.3
  • ```
  • And here is the error I am getting when running pytest:
  • ```
  • venv ❯ pytest my_module.py
  • E ModuleNotFoundError: No module named 'schedule'
  • ```
  • I would appreciate any help in resolving this issue and being able to use the pytest version from the package manager while in the virtual environment. Thank you in advance.
#1: Initial revision by user avatar ShadowsRanger‭ · 2023-07-17T10:20:53Z (10 months ago)
Getting a Module Error When Running Pytest Even Though the Module is Installed in the Current Virtual Environment
Hello everyone,

I am facing an issue when running pytest in my virtual environment. Even though I have installed the required modules in my virtual environment using pip, I am still getting a ModuleNotFoundError when running pytest. I had to install some packages globally using the package manager, but this only works with popular packages since all of them aren't available on the package manager.

As a workaround, I had to uninstall pytest from the package manager and install it in the virtual environment. However, I would prefer to use the pytest from the package manager since it makes sense to me to install a package I use often globally instead of installing it in each virtual environment.

Here is the output of `pip freeze` in my virtual environment:

```
venv ❯ pip freeze
backoff==2.2.1
certifi==2023.5.7
charset-normalizer==3.2.0
feedparser==6.0.10
idna==3.4
pythorhead==0.12.3
requests==2.31.0
schedule==1.2.0
sgmllib3k==1.0.0
urllib3==2.0.3
```

And here is the error I am getting when running pytest:

```
venv ❯ pytest my_module.py
E   ModuleNotFoundError: No module named 'schedule'
```

I would appreciate any help in resolving this issue and being able to use the pytest version from the package manager while in the virtual environment. Thank you in advance.