-1

I am using PyCharm and am having trouble importing modules I set up a venv and imported the dependencies via pip install -r When I try to run the application and get 'module not found' for all imports. If I open a terminal in PyCharm and do pip list all the required modules are listed Further PyCharm can file the modules - I can perform completion when typing the name of the module. What else can I try?

  • You could try setting up an [Anaconda](https://www.anaconda.com/products/individual) virtual environment and then configuring the Python interpreter in PyCharm to use that environment. – Jacob K Jan 06 '21 at 17:01
  • Refer :https://ilovecodesite.wordpress.com/2017/10/22/module-not-found-in-pycharmpythonerror/ – Sreeram M Jan 06 '21 at 17:01

2 Answers2

0

Sounds like you have more than one python environment on your machine. So, in my opinion, you need to manage the environments in python IDE. The same happened to me so this helped me in that. Do check: https://docs.python.org/3/tutorial/venv.html

You can also seek help from the below article: https://www.freecodecamp.org/news/manage-multiple-python-versions-and-virtual-environments-venv-pyenv-pyvenv-a29fb00c296f/

Amandeep
  • 41
  • 6
  • I have read those docs and I thought that a venv gave you an isolated environment. I have a venv for this project and the packages are installed, but the interpreter is not finding them. Have I misunderstood? – user9224574 Jan 07 '21 at 09:30
0

I solved this by checking the boxes 'Add content toots to PYTONPATH' and @Add source roots to PYTHONPATH'