psycopg2 successfully installed, but pip freeze does not show it - linux

I use psycopg2 for my django app.
When i run python manage.py collectstatic i see django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named psycopg2.
Then I run pip install psycopg2, but after successful installation pip freeze does not see it. I have installed libpq-devel and python-devel.
What am i doing wrong?
I am using Linux AMI from Amazon (EC2), if it is important.
UPDATE:
i tried to wget source and install it like python setup.py install. Now i can import psycopg2, but still can't do it in virtualenv.

Somehow, package was installed in directory lib64, but all other packages was installed in directory lib, so I copied psycopg2 from lib64 to lib and everything became all right.

Related

Python Quickstart ModuleNotFoundError: No module named 'google_auth_oauthlib'

I set up a venv for my project and ran pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib to get the Google packages (after activating the venv).
When I attempt to run the Python Quickstart code (which I copy/pasted into my VScode project) I get the error: ModuleNotFoundError: No module named 'google_auth_oauthlib'. I ran pip list and verified that version 0.4.2 is installed.
My setup:
MacOS 10.15.07
VScode 1.53.2
venv Python 3.7.7
To be sure, activate the virtual environment in the shell you will use to run the quickstart and run pip freeze. Additionally make sure your the python you are using is the one in the venv. You can do which python
Maybe try using pip3 install instead? This is what fixed it for me.

I have installed cvlib in python but still can't import it

I installed miniconda and just created a conda environment:
conda create -n my_env python=3.5 anaconda
I am trying to:
import cvlib
But I am getting the error:
ImportError: No module named cvlib
So I have tried to install using:
pip3 install cvlib
This seemed to work successfully, but then when I try to import cvlib I am still getting the ImportError: No module named cvlib error (I have retarted my terminal after the installation).
Is this a problem with my PYTHONPATH not containing the path to the directory that now contains cvlib? If so, how do I find where cvlib is saved so that I can add the path?
Check if the library is in your python directory. Otherwise, make a repl.it account, and install cvlib, and check the functions or the lib name. Maybe try searching a more advanced installation of cvlib.
it might have occurred due to the version of python you installed or due to the directory, you installed.
try uninstalling the current version of python and try installing an older version of python and install it in the directory as shown below:
C:\Users\Rajish\AppData\Local\Programs\Python\Python39
also, select add the path to environment variables while installing
and after that install cvlib and all other required modules and packages
it worked for me.

Socketio installing problems

I'm facing a problem with socketio. I imported it into my programme by command:
import socketio
Wen I typped pip freeze I got:
python-socketio==4.5.1
Then I ran programme by typing into console:
myfile.py --mode "mode"
But it says:
ModuleNotFoundError: No module named 'socketio'
Any ideas how to fix it?
It happens when you have multiple version of pip install on your system.
you can deal with this problem by creating a virtual environment and again loading the socket-io library.
Install pipenv.
pip install pipenv
Then change directory to the folder containing your Python project and initiate Pipenv,
cd your_project
pipenv install
This will build two new files in your project directory, Pipfile and Pipfile.lock, and a new virtual environment for your project, if it doesn't already exist. If you add the —two or —three flags to the last command above, your project will be initialized with the use of Python 2 or 3. Otherwise, Python's default version will be included.
To install a Python package for your project use the install keyword. For example,
pipenv install beautifulsoup4
and for uninstalling
pipenv uninstall beautifulsoup4

Installing Python Packages From local File System

I am trying to install some of the packages (Example: openpyxl) from local file system, however pip installer is always looking package from pypi.org or pypi.python.org and not from the local path.
Below are the commands, I have used.
pip install openpyxl c:\users\test\openpyxl-2.6.3.tar.gz
easy_install openpyxl c:\users\test\openpyxl-2.6.3.tar.gz
After the above commands are executed:I get the below errors:
Searching for openpyxl
Reading https://pypi.python.org/simple/openpyxl/
Download error on https://pypi.python.org/simple/openpyxl/
Installer pointing to pypi.python.org and not the local filesystem.
Encountered in:
Operating System: Windows 10
Python Version: 3.7
Pip Version:10.0.1
Thanks in advance for your help!
your command
pip install openpyxl c:\users\test\openpyxl-2.6.3.tar.gz
should be
pip install c:\users\test\openpyxl-2.6.3.tar.gz
as pip install accepts local paths to .tar.gz files directly.
Note that your pip is also quite outdated. You might want to consider upgrading it to the newest version

Installation of tkinter on python3

I'm using Fedora 21. Installed the python3-tkinter package using yum install python3-tkinter. The package gets stored in the /usr/lib64/python3.4 directory. Is there a way to use pip to install tkinter?
Have a virtualenv setup with python3. When I try to run my program within that virtualenv I get:
ImportError: No module named 'tkinter'.
Does it make sense to copy the package directories from /usr/lib64/python3.4 to the site_packages folder associated with the virtualenv?
I was using python 3.3.2 interpreter. Turns out the default packages installed when running the command yum install python3-tkinter are set to work with python 3.4.1 interpreter. Configuring my virtualenv to use the python 3.4.1 interpreter proved to be the solution as the python interpreter was then able to find the required libraries in it's path.

Resources