Install psycopg2 on Synology - python-2.7

I try to install psycopg2 on my DS2413+ (DSM 4.3). I've installed Python 2.7 with ipkg and pip. When I do :
/opt/local/bin/pip2.7 install psycopg2
I got the following error :
Error: pg_config executable not found.
Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
Complete output from command python setup.py egg_info:
running egg_info
But I didn't found pg_config in my /usr/syno/ where a built in version of pgsql is already installed.
In other topics with this kind of error, they recommend to install python-dev, but I can't manage to install it on my NAS ... There is also a py26-psycopg2 ikpg but I need to install it on Python 2.7.
If anyone has a solution to these problem please tell me :')
Cheers

You don't need to install psycopg2, it is already installed in the site-packages if you used the official Synology python package, see
/usr/local/packages/#appstore/Python/usr/local/lib/python2.7/site-packages/
Also, using pip from ipkg may mess up your python install as there should really be one python2.7 installation.

Related

psycopg2-binary installation into a virtual environment fails when trying to compile source code

I am trying to install psycopg2-binary into my Django project. I am using a virtual environment and the command I'm running is
pip install psycopg2-binary
However, I'm getting a massive error message, the gist of it is this:
Error: pg_config executable not found.
pg_config is required to build psycopg2 from source. Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
If you prefer to avoid building psycopg2 from source, please install the PyPI
'psycopg2-binary' package instead.
But, hey, I'm installing exactly 'psycopg2-binary'
Why am I getting all this mess?
Pip cannot find you processor+OS at https://pypi.org/project/psycopg2-binary/2.9.2/#files so it tried to install from sources (the last file at the page) and failed.
Compiling from sources is currently the only way. If you can donate some spare processor cycles to the Psycopg2 authors they perhaps could start compiling and publishing wheels for OSX on M1.

Can't install psycopg2-binary

I'm trying to install psycopg2-binary (pip3 install psycopg2-binary) inside the virtual environment of my Django project on Centos 7 with preinstalled Postgresql 12 and have the well-known error:
Error: pg_config executable not found.
pg_config is required to build psycopg2 from source. Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
If you prefer to avoid building psycopg2 from source, please install the PyPI
'psycopg2-binary' package instead.
I tried to install python3-devel postgresql-libs postgresql-server postgresql-devel postgresql-contrib, but still have this error.
pip3 install psycopg2, pip install psycopg2 - the same problem.
PS The problem was solved via updating pip (pip install --upgrade pip).
you can try it this method, is very useful
sudo apt-get install postgresql postgresql-dev python-dev

Trying to install Pyramid package with "python setup.py install" gives error searching for a package

I'm working on a Pyramid project that has to be deployed in a Debian 7 server.
The Debian 7 server has the python version 2.7.3 as from the archives repositories.
After creating a virtual environment with virtualenv command the pip version installed in this virtualenv is 1.1.
First thing noted: I can't upgrade pip with pip install --upgrade pip. The version is not updated and remains in 1.1 version.
After installing the OS packages needed to install the project I ran python setup.py install but I get the error:
Searching for zipp==0.5
Reading http://pypi.python.org/simple/zipp/
Couldn't find index page for 'zipp' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
No local packages or download links found for zipp==0.5
error: Could not find suitable distribution for Requirement.parse('zipp==0.5')
So, the python setup.py install command could not recognize the zipp package.
I thought that this was related to the older version of pip (1.1). So I could update pip version successfully using the index-url option:
$ pip install --index-url https://pypi.python.org/simple --upgrade pip
That updated pip version from 1.1 to 20.3b1. Then I tried python setup.py install again, but the same error occurred.
What I could see is that, after updating pip version, the zipp==0.5.0 package is installed if I ran pip install zipp==0.5.
I'm new to Pyramid and the package installing using the setup.py module. I'm not understanding why I can install the zipp package with pip and can't with python setup.py install.
I'm not putting the content of setup.py here because I think it's not a problem of the setup.py script. With more recent versions of python and pip in an Ubuntu 18.04 machine the setup.py works like a charm.
Someone could explain how to solve this issue?
When you run python setup.py install directly, you are not using pip, so the version of pip you have installed is irrelevant. This command is antiquated, should not be used, etc, etc. The right answer is to use pip install . as a replacement for python setup.py install and to use pip install -e . as a replacement for python setup.py develop.
With respect to what you're seeing, when you run python setup.py install this using the version of easy_install bundled with setuptools to talk to PyPI and install dependencies. This should be avoided for a lot of reasons but just know that to override urls it uses they go in ~/.pydistutils.cfg and have nothing to do with pip. HTTPS is one problem that you looked at, another is that old versions of Python do not have the right CA trust store, nor support the minimum required TLS 1.2 to handshake with PyPI. So expect lots of problems using old tools - at the very least try to use pip instead of easy_install.

Error installing django-heroku Error: pg_config executable not found

I tried installing django-heroku via pip so I can deploy my project on heroku but during installation of django-heroku it tried to install psycopg2 along only to produce an error:
Error:pg_config executable not found.
pg_config is required to build psycopg2 from source.please add the directory containing pg_config to the $PATH or specify the full executable path with the option:
python setup.py build_ext--pg-config/path/to/pg_config build...
or with the pg_config option in 'setup.cfg'.
And I also wish to know if I'm required to pip install it since heroku installs the libaries specified in the requirements.txt file,if not required are there changes I need to make to my project before deployment.
Perhaps not optimal solution but it did work for me.
pip install --no-dependencies django-heroku
Be sure to have other required packages installed.
pip install django
pip install whitenoise
pip install psycopg2-binary
P.S. I have already had postgresql installed on my Mac. Not sure why I was getting the same error.
I renamed "psycopg2" in the python site packages folder to "psycopg2-binary", and this fixed my issue.

python pip install error language_check

When I am trying to install sudo pip install language_check
I got this error:
Collecting language_check
Downloading language-check-1.0.tar.gz
Complete output from command python setup.py egg_info: zip_safe flag not set; analyzing archive contents...
Installed /tmp/pip-build-_cYgOq/language-check/.eggs/3to2-1.1.1-py2.7.‌​
egg error in language-check setup command: package_data must be a dictionary
mapping package names to lists of wildcard patterns
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-_cYgOq/language-check/
It's a bug in language-check. They fixed it at 23 March but didn't include in any release yet (release 1.0 was from 21 March).
Download the sources from Github and install with
python setup.py install
I believe that if you install the latest version of Python, python3.6.2 it should work.
git clone -b patch-1 https://github.com/SpartorA/language-check.git
python setup.py install
Above will work
I was able to successfully install language-check in my Python 3.7 environment on MacOS as follows:
Check Java installation :
for language-check, Java 8 is expected
For MacOS: Follow these steps : https://stackoverflow.com/a/24657630
Install language-check
pip install language-check, won't directly work, you would have to:
Install from a forked & fixed repo for language-check
pip install git+https://github.com/MCFreddie777/language-check.git