Error while installing psycopg2 in Windows - python-3.x

I tried to install psycopg2 as:
pip install psycopg2
It was giving error for pg_config. I checked some stackoverflow notes and installed PostgreSQL. Added the path of pg_config in $PATH.
Now it is giving the below error:
LINK : fatal error LNK1181: cannot open input file 'libpq.lib'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.14.26428\\bin\\HostX86\\x64\\link.exe' failed with exit status 1181
Any help on this?

Have you tried reinstall without pip?
sudo apt-get install python3-psycopg2
EDIT: Since you're on windows:
You can try this if you're using python 2.7:
pip uninstall psycopg2
pip install git+https://github.com/nwcell/psycopg2-windows.git#win64-py27#egg=psycopg2
If you're using python 3.4:
pip uninstall psycopg2
pip install git+https://github.com/nwcell/psycopg2-windows.git#win64-py34#egg=psycopg2
More info here.
If you prefer, you can download the installer (.exe) and install it.
You can find it here.

I found the issue.... I was using Python 3.7 version. Looks like the latest stable version of psycopg2 (2.7.4) is not yet supported on Python 3.7. It is supported till 3.6
I downgraded my python to 3.6.5 in Anaconda and also to 2.7.15 through PyCharm. I was able to install psycopg2 in both and use them.

Go to https://pypi.org/project/psycopg2
in release history and select the version you want to download.
There will be a table with files and the versions of python that can be compatible with the selected version.
Now download the wheel file that matches your system configuration(mac/linux/win-32/win-64)
I did this and was able to download the package.
For windows10(64-bit), download psycopg2-2.7.7-cp36-cp36m-win_amd64.whl (998.5 kB), in case you have selected 2.7.7

For Windows users, to install the psycopg2 without any errors first install Python 3.7.4 version and then install psycopg2 using command pip install psycopg2 as it worked complete fine with me. I think there is some issue in Python 3.8.0 version onwards because while installing psycopg it is showing an error in setup wheels.

In case you are here in 2020, this is a problem with version 3.8 of python. I had the issue recently. Try using virtualenv so that you can use lower versions of python in your workspace until psycopg2 is supported fully on Python version 3.8

Related

Error installing eth-brownie with pipx: "No Python at: <Location of Old Python Installation>"

I'm trying to install eth-brownie. Followed the Brownie documentation and installed pipx, then ran pipx ensurepath. I was originally using Python 3.10 but couldn't install it, found that this was pretty common and the best fix was to downgrade to 3.9.
After uninstalling 3.10 and installing 3.9, I ran everything again. When I run pipx install eth-brownie, I get the following error:
C:\Users\garri>pipx install eth-brownie
No Python at 'C:\Users\garri\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\python.exe'
Fatal error from pip prevented installation. Full pip output in file:
C:\Users\garri\.local\pipx\logs\cmd_2022-03-28_13.40.53_pip_errors.log
Error installing eth-brownie.
I removed Python 3.10 from Path and python --version returns 3.9.12 as expected. I'm at a loss, as I feel like I've tried everything. Any help would be greatly appreciated.
This is basically a pipx cache issue. You have to delete the following folder to remove pipx related cached files.
C:\Users\<username>\.local\pipx

Could not find a version that satisfies the requirement MetaTrader5

I am trying to install a python package MetaTrader5 using the command
python3 -m pip install MetaTrader5
and I have even tried
pip install MetaTrader5
But it throws the following error
ERROR: Could not find a version that satisfies the requirement MetaTrader5 (from versions: none)
ERROR: No matching distribution found for MetaTrader5
I am using
Ubuntu 16.04.6
Python 3.6.10
can someone help with this?
I have a mac. On it I have conda installed on MacOS. In addition I have a virtual machine running windows and I have also installed conda on Windows. I could install MetaTrader5 package using pip on the virtual machine but not on MacOS.
According to this Youtube video, MetaTrader5 currently doesn't support Ubuntu. It's only available on Windows.
If you look at Pypy and view the wheel files, you will see that all the builds are for Windows. pip is refusing to install because it can't find a Mac or Linux version.
https://pypi.org/project/MetaTrader5/5.0.37/#files
Download python version 3.10.0 then try installing metatrader5.
here the link: https://www.python.org/downloads/release/python-3100/
Metatrader 5 for Python, only work in exact versions:
Install one of version below to MT5 works.
Python Versions for Metatrader5

Installing Spacy is failing with Python 3.7 on Windows 10

Installing Spacy on Windows 10 with pip is failing. Installing any other of a number of modules is working fine for me.
Here is a pastebin containing the error message:
pip install -U spacy
or
python -m pip install spacy
output:
https://pastebin.com/Y9np4veN
I have tried this both with and without virtualenv and it is failing in the same manner either way. I have also already tried installing and updating setuptools. I've ensured that I am using Python 3.7 and pip3. There is no other version of python or pip installed on my PC.
I downgraded to Python 3.6 and was able to successfully install spacy
Using x86-64 ("64-bit") version of Python 3.7 (3.7.4) instead of x86 ("32-bit") one on Windows fixed the issue for me.

ERROR in install opencv in my python 3.6.6

I HAVE PYTHON 3.6.6 INSTALLED IN MY WINDOWS 7 PLATFORM BUT WHEN I TRIED TO INSTALL OPENCV PACKAGE IT SAYS REQUIREMENT ALREADY SATISFIED AND IF I TRY TO IMPORT CV2 IT SAYS NO MODULE .I'VE TRIED ALL POSSIBLE METHODS ON INTERNET WHAT SHOULD I DO
i tried to download opencv exe from sourceforge and copying cv2.pyd file and then pasting it in site packages
i tried pip install opencv_python-4.0.1-cp37-cp37m-win_amd64.whl
but nothing works
The error message says that you are asking PIP install a version of cv2 for 64-bit Python 2.7, and that installation is failing. So the installation is not happening because it's the wrong version. That might be because you don't have Python 2.7, or because you have a 32-bit processor, or both. Navigate to Python36\Scripts and issue the command pip install opencv_python. Then pip will find the appropriate file to download, and install it.

Install NumPy for Python 3.5

I am using python 3.5 and I am trying to install NumPy but when I try to install from command prompt using command: pip install numpy
I get a whole lot of errors. The main error though seems to be at the end: error: Unable to find vcvarsall.bat
I have also tried downloading the numpy binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy and installing using command: pip install numpy-1.10.4+mkl-cp35-cp35m-win_amd64.whl
But I get an error that says: numpy-1.10.4+mkl-cp35-cp35m-win_amd64.whl is not a supported wheel on this platform.
Then I found a numpy-1.10.2-win32-superpack-python3.4.exe file here https://sourceforge.net/projects/numpy/files/NumPy/1.10.2/ but when I try to run that I get an error that I require Python version 3.4.
I looked and cannot find an installer for python 3.5.exe, do I need to uninstall python 3.5 and install 3.4 instead? Or is there anyway to install numpy for Python 3.5?
I am using Windows 10/64 bit.
An easy way to obtain numpy, scipy, pandas, ... is to install anaconda.
Anaconda will automatically download and install the latest modules.
https://www.continuum.io/downloads
I hope this will help you along.

Resources