Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Python3 is unable to locate any of my installed modules

$
0
0

I am currently trying to work on a project for a course and I am using a python file to collect data using an API.

When I attempted to run my code this morning I was met with a ModuleNotFoundError when executing the file from my bash script:

Then to see if it was just in VSCode (which I am using) I went to my terminal and started python3 and tried to import the module:

trevormoy@158 Edstem-Tracker % python3Python 3.12.3 (main, Apr  9 2024, 08:09:14) [Clang 15.0.0 (clang-1500.3.9.4)] on darwinType "help", "copyright", "credits" or "license" for more information.>>> import edapiTraceback (most recent call last):  File "<stdin>", line 1, in <module>ModuleNotFoundError: No module named 'edapi'>>> exit()

So, trying to run it in both cases results in an error.

Note: I have ran pip3 list and I have confirmed the module is in there.

I proceeded to try other external python modules only to be met with the same error.

In VSCode I decided to run the code with the Run Python File command:

button for running python file

When I run this the code runs completely fine but now I am trying to understand why my python3 is unable to find my modules.

  1. When I first tried to try to fix the issue I tried uninstalling and reinstalling the module I initially had trouble with. After realizing all my modules weren't working I moved to other types of fixes.

  2. I adjusted my script so that it runs:

     /usr/bin/python3 "edstem/integration/get_data.py"

    This actually ran my code correctly in the bash script with no errors. The only issue is that I need to account for Windows users that might use the project so, using /usr/bin/python3 won't work.

    Because/usr/bin/python3 worked I decided to look in my bash profiles which appeared to be working fine. After I looked there I decided to echo my $PATH but was not sure if I was looking for the right thing. I saw that Python/3.9/bin was in my $PATH twice but I don't know if that matters in this case.


Viewing all articles
Browse latest Browse all 23131

Trending Articles