BigBalboa
BigBalboa

Reputation: 61

ModuleNotFoundError but module is installed

I have pip installed colorgram.py but I am still getting an error:

ModuleNotFoundError: No module named 'colorgram'

I have also created a path to the python location:

C:\Users\me\AppData\Local\Programs\Python\Python39

C:\Users\me\AppData\Local\Programs\Python\Python39/scripts

any idea how to fix this?

Upvotes: 6

Views: 23128

Answers (4)

Josh Graham
Josh Graham

Reputation: 153

I solved this issue recently by updating my $PYTHONPATH to match my site-packages. I couldn't use a module command from the commandline (e.g. ModuleNotFoundError: No module named 'onelogin_aws_cli')

  1. When you pip install the Module, note where it's already installed (e.g. Requirement already satisfied: onelogin-aws-cli==0.1.6 in ./venv/lib/python3.9/site-packages (0.1.6))
  2. Set your Python path to the location of the site packages (e.g. export $PYTHONPATH=./venv/lib/python3.9/site-packages)

I was then able to use the onelogin_aws_cli command from the commandline.

Upvotes: 1

same problem. Try to create a new project, it's probably you install colorgram.py after creating the project and the module is not contained in venv, installing colorgram.py from pycharm directly might help too.

Upvotes: 0

bonkey
bonkey

Reputation: 41

I ran into this same issue which brought me here.

I found a solution in my case. The package was installed, attempts to re-install said requirement already satisfied.

In my case the tool I was trying to use (pytest) was not installed in the venv but was installed in the path. Installing pytest into the same venv solved the issue.

Upvotes: 1

Gian Laager
Gian Laager

Reputation: 514

I guess you've installed the module with a different python version than you have run it. To fix this you can run python -m pip install <the-name-of-the-module> and than run the script with python <path-to-your-script>. If you want to use python3 just replace all python with python3.

Upvotes: 5

Related Questions