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

已回答

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.

3

Hello! 

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

0

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

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

@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

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

0

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
Avatar
Permanently deleted user

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

Hi Amdpzc,

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

0
Avatar
Permanently deleted user

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

0

Have the same problem. Virtual environment was renewed (old python3.7 env was dropped, new python3.8 env was created with the same path). Now I can import a library in python console in a terminal or in PyCharm's python console but starting project with PyCharms Run (correct interpreter is set) I'm getting import errors... The same startup command works just fine from console.

BTW your WISIWIG comments redactor is awful when working with images (I'm using Firefox 90.0).


 

0

请先登录再写评论。