PyCharm doesn't see packages when I "Run" a script...

Answered

Hi guys,

 

I have latest PyCharm 2017.3 running on OSX 10.12.6. I have Python 3.6.4 installed.

So, I have a project which is running in production.

I have all needed packages in my virtual environment. IDE editor sees all packages and does't highlight missing packages.

The problem is when I want to "Run" simple scripts via IDE I always get error:

/usr/local/bin/python3.6 /Users/maxb/Projects/XXX/XXX/checker/checker1.py
Traceback (most recent call last):
File "/Users/maxb/Projects/SocHub.me/XXX/XXX/checker/checker1.py", line 5, in <module>
import requests
ModuleNotFoundError: No module named 'requests'

Process finished with exit code 1

I have tried everything from google search - nothing helps. I believe it is a bug in PyCharm.

9 comments
Comment actions Permalink

Hello! 

Does it work correctly from the system Terminal with the same interpreter?

0
Comment actions Permalink

Yes, it does work via Terminal in IDE. The terminal in IDE starts with venv enabled automatically.

 

If you mean "System Terminal" - my iTerm app- I didn't try. Should I?

0
Comment actions Permalink

I see that you run the script with /usr/local/bin/python3.6 system interpreter. Please make sure that your Run configuration uses a correct interpreter where requests library is installed (Run| Edit Configurations...| checker1).

0
Comment actions Permalink

@Anna - It uses correct interpreter. I checked it many times very carefully.

The whole project is working fine with my venv.

I just have problems with Running scripts from IDE. I think "Run" does not use my venv somehow...

0
Comment actions Permalink

Could you please attach a screenshot of Run| Edit Configurations...| checker1?

0
Comment actions Permalink

Hi Anna,

 

This is screenshot of the screen you asked: https://monosnap.com/file/JSh6Up5BvZZQDiUaZv1I43FrKsb3AW

Here is a screen of "Project Interpreter": http://take.ms/rwQiX

http://take.ms/sfdL3

http://take.ms/U02iD

 

I hope it will help...

0
Comment actions Permalink

Any help on this I'm having the same problem.?

 

all Pkgs are shown in my settings for my interpreter but once i run a script and call say numpy or matplotlib pandas etc none are recognized and when i call the exact same script in the anaconda terminal it works 

i am using the same interpreter on both so not sure why this is happening. 

0
Comment actions Permalink

Hi Amdpzc,

Please attach screenshots of the problem, of Run/Debug Configuration and of Project Interpreter.

0
Comment actions Permalink

Your IDE definetely not supporting python library that is installed afterward.

0

Please sign in to leave a comment.