3
votes

I started a project without PyCharm and I setup a VirtualEnv which I have installed Django, Pillow etc.

I have imported the project to PyCharm and even if I configured the Project Interpreter to the location of the VirtualEnv, PyCharm seems that don't recognise the installed modules in this virtual environment.

The project interpreter location looks like this:

path/to/project/virtualenv_folder/bin/python3.5

Now PyCharm Project Interpreter has only the basic packages shown in the table like pip, setuptools, wheel but not the ones I have in virtualenv which are Django, Pillow.

I am sure that the packages are installed in that virtualenv because I did:

source path/to/project/virtualenv_folder/bin/activate
pip freeze

And the packages are there. I search all the documentations of JetBrain and I couldn't find anything.

PyCharm Version: Professional 2016.1

2

2 Answers

7
votes

How did you add the virtual environment to PyCharm? The correct way is:

  1. Open preferences
  2. Open Project
  3. Open Project Interpreter
  4. Select the ... at the end of dropdown where you can select your interpreter.
  5. Choose Add local
  6. Select the python link in your own created virtual environment /bin directory.
  7. Finally, click ok, and your virtual environment should be visible in PyCharm with all the bells and whistles.

HTH

OK. I read your answer and obviously the work around did it for you. Still strange. Are you on 2016.1.4?

1
votes

I manage to solve my problem by creating the virtualenv within PyCharm to the project directory.

Now installing packages from terminal or/and within PyCharm will work for both terminal and PyCharm.