Search code examples
djangopycharmvagrant

Pycharm Django Project using Vagrant Server: Error Package requirements are not satisfied


I am trying to start a Django Project using Vagrant and PyCharm Professional edition. I am using a Windows computer and my Vagrant file looks like this https://gist.github.com/LondonAppDev/d990ab5354673582c35df1ee277d6c24

Below is my project just in case (not really required to answer this question ) https://github.com/samirtendulkar/profiles-rest-api

Now through Pycharm Terminal I added

vagrant init
vagrant up
vagrant ssh
vagrant@ubuntu-xenial:/$ mkvirtualenv profiles_app_venv --python=python3
(profiles_app_venv) vagrant@ubuntu-xenial:/$ pip install django==1.11
(profiles_app_venv) vagrant@ubuntu-xenial:/$ pip install djangorestframework==3.6.2

Then I added a src folder in my root project and started making another app

Then I created a requirements.txt

(name_of_env) vagrant@ubuntu-xenial:/vagrant/$ pip freeze > requirements.txt

See Image below. I know that this is because my project in running on my Vagrant server and my Pycharm is running on my host server. But I am losing out on all of Pycharm's best features. How can I override this

enter image description here

Any Idea What I need to do here

enter image description here


Solution

  • You don't need to override anything. The problem is that you included a requirements.txt file without setting your project interpreter. What you should do is go to Settings > Project > Project Interpreter, and choose your project interpreter to be the path where profiles_app_venv lives on your local server. A few seconds after applying this (or immediately if you restart PyCharm), you should see those warnings go away as it recognizes that they are installed in your chosen interpreter.