I created virtual environment for Django procject using Pycharm and Anaconda. The problem is that I can not install django-haystack library into virtual environment.
I tried installing it with anaconda, pycharm itself and tried using pip install django-haystack
. Using pip install I can see that library is installed.
Installing collected packages: django-haystack
Successfully installed django-haystack-2.8.1
I saw post earlier which had similar problem where libraries were installed in python "[Python packages not installing in virtualenv using pip " but here the solution was not to use sudo
installing library, but I am not using it.
Does anybody know how can I install this library into virtual environment ? I run everything on windows
Update on the issue
using pip freeze output I can see that django-haystack is installed:
Django==2.1
django-haystack==2.8.1
elasticsearch==6.3.0
But still then I run py -3 manage.py startapp search
I get this error:
ModuleNotFoundError: No module named 'haystack'
This is how my settings.py file looks :
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'haystack'
]
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
'URL': 'localhost:9200',
'INDEX_NAME': 'haystack',
},
}
py -3 -m site
output:
sys.path = [
'C:\\Users\\Joha\\PycharmProjects\\untitled1',
'C:\\Python\\python36.zip',
'C:\\Python\\DLLs',
'C:\\Python\\lib',
'C:\\Python',
'C:\\Python\\lib\\site-packages',
]
USER_BASE: 'C:\\Users\\Joha\\AppData\\Roaming\\Python' (doesn't exist)
USER_SITE: 'C:\\Users\\Joha\\AppData\\Roaming\\Python\\Python36\\site-packages' (doesn't exist)
ENABLE_USER_SITE: True
where pip output:
C:\Users\Joha\Anaconda3\envs\test_haystack\Scripts\pip.exe
C:\Python\Scripts\pip.exe
where py output:
C:\Windows\py.exe
Ok so the problem was that pip has two paths. How can I remove one of the paths, so it would use just virtenv but not global path ?