Error: could not determine PostgreSQL version from "10.4" - python

Complete output from command python setup.py egg_info: running
egg_info creating pip-egg-info/psycopg2.egg-info writing
pip-egg-info/psycopg2.egg-info/PKG-INFO writing top-level names to
pip-egg-info/psycopg2.egg-info/top_level.txt writing dependency_links
to pip-egg-info/psycopg2.egg-info/dependency_links.txt writing
manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt' Error:
could not determine PostgreSQL version from '10.4'
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-lR9u0X/psycopg2/
Does anyone know what's the issue? Trying to run pgadmin in virtualenv and can't figure out because of this error.

A higher version of psycopg2 fixed the issue for me, update your requirements.txt to:
...
psycopg2==2.7.5
...

Solution for me:
$wget https://files.pythonhosted.org/packages/51/2f/48c3bda0b629f6e6b2c0dc57d737f2612389d2c43797209034c604349b71/redshift-sqlalchemy-0.4.tar.gz
$ tar -zxvf redshift-sqlalchemy-0.4.tar.gz
Change inside requires.txt psycopg2==2.5 to psycopg2 (2.7.6.1)
$vi redshift-sqlalchemy-0.4/redshift_sqlalchemy.egg-info/requires.txt
.......
psycopg2==2.7.6.1 <---Change Here
SQLAlchemy>=0.8.0
.................
Change inside setup.py psycopg2
$vi redshift-sqlalchemy-0.4/setup.py
CHANGE
..........
install_requires=['psycopg2==2.5', 'SQLAlchemy>=0.8.0'],
..........
TO
..........
install_requires=['psycopg2==2.7.6.1', 'SQLAlchemy>=0.8.0'],
Run the manual pip installation
$ pip install -r redshift-sqlalchemy-0.4/redshift_sqlalchemy.egg-info/requires.txt file:///home/etl/redshift-sqlalchemy-0.4/

Related

No version is set for command pg_config

I am attempting to install psycopg2 for use within a project. I am also using asdf in order to manage my python versions. I have tried doing this inside of a venv but I get the same error so to keep things simple let's just say I want to install it outside of a venv.
❯ cat .tool-versions
nodejs 15.9.0
python 3.10.8
postgres 11.8
❯ which pip
~/.asdf/shims/pip
❯ which pg_config
~/.asdf/shims/pg_config
❯ pg_config --version
PostgreSQL 11.8
❯ pip install psycopg2
Collecting psycopg2
Using cached psycopg2-2.9.5.tar.gz (384 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [9 lines of output]
~/.asdf/installs/python/3.10.8/lib/python3.10/site-packages/setuptools/config/setupcfg.py:463: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
warnings.warn(msg, warning_class)
running egg_info
creating <redacted_temp_folder>/T/pip-pip-egg-info-3tgyoyym/psycopg2.egg-info
writing <redacted_temp_folder>/T/pip-pip-egg-info-3tgyoyym/psycopg2.egg-info/PKG-INFO
writing dependency_links to <redacted_temp_folder>/T/pip-pip-egg-info-3tgyoyym/psycopg2.egg-info/dependency_links.txt
writing top-level names to <redacted_temp_folder>/T/pip-pip-egg-info-3tgyoyym/psycopg2.egg-info/top_level.txt
writing manifest file '<redacted_temp_folder>/T/pip-pip-egg-info-3tgyoyym/psycopg2.egg-info/SOURCES.txt'
Error: b'No version is set for command pg_config\n'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
Everything I can find seems to revolve around installing pg_config or postgresql or some other dependency but no one else seems to have encountered this exact error. The best I can figure is that somehow the process python setup.py egg_info is not using the same $PATH as the root command, maybe because it's working directory is outside of the scope of my .tool-versions? Any help is appreciated.
It appears that the correct way to get pip to find pg_config is to set the postgres version globally:
asdf global postgres 11.8
source

pip install package call setup.py install instead of setup.py bdist_wheel

I have create a private package and simply all things are well. setup.py bdist_wheel simply create the wheel for it and other commands works correct.
also pip install package_xxx.whl works fine and installs the created wheel correctly. but when I try to pip install the package from a requirement file or git repo or local path, it sucks...
As you know the pip will call setup.py file
In my case the setup.py file called twice with following arguments: (captured from sys.argv)
['-c', 'egg_info', '--egg-base', 'pip-egg-info']
['-c', 'install', '--record', '/long/path/to/install-record.txt', '--single-version-externally-managed', '--compile']
but for example if I pip install coverage the setup.py file of coverage package called twice with following:
['-c', 'egg_info', '--egg-base', 'pip-egg-info']
['-c', 'bdist_wheel', '-d', '/long/path/to/tmp82jyoapip-wheel-', '--python-tag', 'cp27']
the first call to setup.py in my package and the coverage.py package is same and pip gets the egg-info data. then it call setup.py bdist_wheel on coverage.py (the desired behavior) but call setup.py install on my package (broken behavior) that lead to create egg-like project not wheel one.
my setup.py file is in following gist: https://gist.github.com/wtayyeb/f26578fe6ff17dc6acd3
it is beside other files in the package and as I say all things are working except pip install /path/to/mypackage
Thanks.
The problem was in folder name that containes setup.py. I have found it with inspecting pip and found the critical check which was direct the process to legacy method. see below link if you intrest in it.
https://stackoverflow.com/a/35590238/875667

Installing selenium for Python in Windows 7

I am trying to install "selenium-2.44.0" for "Python-3.4.1" on Windows 7 64 bit machine. I downloaded "selenium-2.44.0.tar.gz" and extracted to "Desktop" folder.
When I execute the command:
C:\Python34>python C:\Users\User_Name\Desktop\selenium-2.44.0\setup.py install
I get the following output:
running install
running bdist_egg
running egg_info
creating selenium.egg-info
writing selenium.egg-info\PKG-INFO
writing dependency_links to selenium.egg-info\dependency_links.txt
writing top-level names to selenium.egg-info\top_level.txt
writing manifest file 'selenium.egg-info\SOURCES.txt'
warning: manifest_maker: standard file 'setup.py' not found
error: package directory 'py\selenium' does not exist
running install
running bdist_egg
running egg_info
creating selenium.egg-info
writing selenium.egg-info\PKG-INFO
writing dependency_links to selenium.egg-info\dependency_links.txt
writing top-level names to selenium.egg-info\top_level.txt
writing manifest file 'selenium.egg-info\SOURCES.txt'
warning: manifest_maker: standard file 'setup.py' not found
error: package directory 'py\selenium' does not exist
But, within "selenium-2.44.0" folder, "py\selenium" directory exists.
Help!!
Thanks
As I mentioned in the comments, I can install selenium using the following when in the untarred archive's directory:
c:\Python34\python.exe setup.py install
This worked for me on Windows 7 with selenium 2.44.0.
Another way to install it would be to use pip:
c:\python34\scripts\pip.exe install selenium
Occasionally when installing packages on Windows, the package you download is corrupted or incomplete and you need to try reinstalling.

PIP install "error: package directory 'X' does not exist"

I am trying to install this package via PIP. It gives me the following error:
error: package directory 'RTbatch' does not exist
I find this weird, because the relevant setup.py does not mention any packages variable, but only py_modules.
What's wrong? Can you help me out?
Here is the full output of pip install -e RTbatch:
Obtaining file:///home/chymera/RTbatch
Running setup.py (path:/home/chymera/RTbatch/setup.py) egg_info for package from file:///home/chymera/RTbatch
/usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'heywords'
warnings.warn(msg)
error: package directory 'RTbatch' does not exist
Complete output from command python setup.py egg_info:
/usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'heywords'
warnings.warn(msg)
running egg_info
creating RTbatch.egg-info
writing requirements to RTbatch.egg-info/requires.txt
writing RTbatch.egg-info/PKG-INFO
writing top-level names to RTbatch.egg-info/top_level.txt
writing dependency_links to RTbatch.egg-info/dependency_links.txt
writing manifest file 'RTbatch.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
error: package directory 'RTbatch' does not exist
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /home/chymera/RTbatch
Storing debug log for failure in /home/chymera/.pip/pip.log
py_modules takes a list of module names, not files. Your call looks for RTBatch/py.py and RTBatch_cli/py.py.
In my case, it was about that the folder which I use for installation was corrupted. It was not installed completely. I downloaded it on my laptop and then moved it to the server. But it was broken. so I download it again and everything goes well.
In my case, I was on Windows and the current directory was in a different drive, python <full path including drive>/setup.py install fails, had to change to the drive and folder and use python setup.py instead.
It seems you have added project folder (RTbatch) as a package in setup.py. Just make sure to have packages list in setup.py contains only python packages (ex: folders with init.py).
Hope this fix the issue.

I can't install python package, although required libraries exist

I am trying to install a Python package and I get a dependency error but I am sure I have fulfilled that requirement.
It says that it can't find libdickinson.so, but this library is already installed (system wide) and its files are in /user/local/lib/. What am I doing wrong?
This is my console output:
(iwidget)chris#mint-desktop ~ $ pip install pthelma
Downloading/unpacking pthelma
Downloading pthelma-0.7.2.tar.gz (50kB): 50kB downloaded
Running setup.py egg_info for package pthelma
libdickinson.so: cannot open shared object file: No such file or directory
Please make sure you have installed dickinson
(see http://dickinson.readthedocs.org/).
Complete output from command python setup.py egg_info:
libdickinson.so: cannot open shared object file: No such file or directory
Please make sure you have installed dickinson
(see http://dickinson.readthedocs.org/).
----------------------------------------
Command python setup.py egg_info failed with error code 1 in /home/chris/.virtualenvs/iwidget/build/pthelma
Storing complete log in /home/chris/.pip/pip.log
(iwidget)chris#mint-desktop ~ $ ls /usr/local/lib/
libdickinson.a libdickinson.la libdickinson.so libdickinson.so.0 libdickinson.so.0.0.0 python2.7/ python3.2/ site_ruby/
(iwidget)chris#mint-desktop ~ $
Also try the above command as superuser:
sudo pip install pthelma
and just go through the thread given below:
Why can't Python find shared objects that are in directories in sys.path?
Try building it yourself and installing from the GIT repo:
git clone https://github.com/openmeteo/pthelma.git
Also, try running it as super user (pip).
sudo pip install pthelma
It looks like it can't see the libdickinson.so file but if you're confident it's installed and setup correctly you can, as I said, try cloning the source and building it that way.

Categories

Resources