Error installing psycopg2 in cygwin - python

I'm trying to install psycopg2 in cygwin but have not succeeded yet.
The error is:-
Gaurav#gauravpc ~/FieldAgentWeb/FieldAgentWeb
$ easy_install psycopg2
Searching for psycopg2
Reading http://pypi.python.org/simple/psycopg2/
Reading http://initd.org/psycopg/
Reading http://initd.org/projects/psycopg2
Best match: psycopg2 2.4.2
Downloading http://initd.org/psycopg/tarballs/PSYCOPG-2-4/psycopg2-2.4.2.tar.gz
Processing psycopg2-2.4.2.tar.gz
Running psycopg2-2.4.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-QBYpxH
/psycopg2-2.4.2/egg-dist-tmp-gcLa5F
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'.
error: Directory not empty <built-in function rmdir> /tmp/easy_install-QBYpxH/ps
ycopg2-2.4.2/tests
After that i was trying to get d pg_config file, but couldn't find it on the net.

I just managed to install psycopg2 today without installing the windows PostgreSQL (in my case the db is already set up in another server, I just need to connect to it with a python package which depends on psycopg2, so having the complete installation it was not necessary for me).
Following pg_config executable not found , from the cygwin setup I installed postgresql-devel AND libpq-dev ( those should be the necessary ones, for the record I installed also a lot of other packages relative to postgresql like postgresql-client, postgresql-plpython and libpq5).
After that I could run succesfully pip install psycopg2

pg_config is part of your PostgreSQL installation. It's in the bin directory of your local installation (e.g. C:\Program Files (x86)\PostgreSQL\9.0\bin). Add that directory to your search path and try to build again.

Related

(Python) psycopg2 installation

I have a fairly light amount of experience with Python and got stuck on what should be a pretty simple issue. I am using Jupyter Notebook on a Mac.
I wanted to install psycopg2 in Python so I typed in
import psycopg2 as pg2
But, I got the following error:
ModuleNotFoundError Traceback (most recent call
last)
<ipython-input-1-32fa0c891bdd> in <module>
----> 1 import psycopg2 as pg2
ModuleNotFoundError: No module named 'psycopg2'
I then went over to the terminal and typed in:
pip install psycopg2
which resulted in another 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 ...
I'm not sure how to go about using this information in the error message. Can someone help point me in the right direction?
Also follow up question:
a.) Why would I need to use pip install modulename in the terminal when I don't have to do that with either pandas or numpy?
Any help would be appreciated.
Please try installing psycopg2-binary as you probaly do not have all the C library dependencies installed on your computer.
pip install psycopg2-binary

Trying to install lucene for python. First need to install jcc. When building setup.py for jcc, I get the error ld: library not found for -ljava

Trying to install lucene for python.
First need to install jcc. When building setup.py for jcc, I get the error ld: library not found for -ljava
Entire error can be found [here][1]:
this is code
The documentation for JCC states:
JCC’s setup.py file needs to be edited before building JCC to specify the location of the Java Runtime Environment’s header files and libraries.
See also building JCC.
On my OSX system, the discovered JAVAHOME and JAVAFRAMEWORKS are echoed when running install:
$ python setup.py install
found JAVAHOME = /Library/Java/JavaVirtualMachines/jdk1.8.0_141.jdk/Contents/Home
found JAVAFRAMEWORKS = /System/Library/Frameworks/JavaVM.framework
...
I tested with Python 2.7. Also, from the jcc source directory:
>>> from helpers2.darwin import JAVAHOME, JAVAFRAMEWORKS
found JAVAHOME = /Library/Java/JavaVirtualMachines/jdk1.8.0_141.jdk/Contents/Home
found JAVAFRAMEWORKS = /System/Library/Frameworks/JavaVM.framework
If your JAVAHOME isn't discovered, you can set the environment variable JCC_JDK. Example:
$ ls /Library/Java/JavaVirtualMachines/
jdk1.7.0_80.jdk jdk1.8.0_25.jdk
jdk1.8.0_141.jdk jdk1.8.0_91.jdk
$ JCC_JDK=/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home python setup.py install
In this case it looks like jdk1.7.0_80 is used for the compilation, but the first two line of output are:
found JAVAHOME = /Library/Java/JavaVirtualMachines/jdk1.8.0_141.jdk/Contents/Home
found JAVAFRAMEWORKS = /System/Library/Frameworks/JavaVM.framework
So that seems misleading, but appears to still work correctly.

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.

Python's “easy_install” on Windows - HtmlCSSInclude

I just installed Python 2.7 and easy_install-2.7.exe on my Windows 2003 server, then set %PATH% to C:\Python27;C:\Python27\Scripts;. Then I tried to install a python package with easy_install, but easy_install failed. The failure follows:
C:\>easy_install HtmlCssInclude
Searching for HtmlCssInclude
Reading http://pypi.python.org/simple/HtmlCssInclude/
Best match: HtmlCssInclude 0.1.2
Downloading http://pypi.python.org/packages/source/H/HtmlCssInclude/HtmlCssInclu
de-0.1.2.tar.gz#md5=0b4438bf62ae66842a514dcff67c0cd7
Processing HtmlCssInclude-0.1.2.tar.gz
Running HtmlCssInclude-0.1.2\setup.py -q bdist_egg --dist-dir c:\docume~1\admini
~1\locals~1\temp\1\easy_install-qpossf\HtmlCssInclude-0.1.2\egg-dist-tmp-haku7q
C:\Python27\Lib\distutils\dist.py:267: UserWarning: Unknown distribution option:
'auther'
warnings.warn(msg)
warning: no files found matching 'testdata'
error: Setup script exited with error: can't copy 'sample.css': doesn't exist or
not a regular file
Anybody please help me.
I tried editing this package and it installed.
Downloaded the package and edited HtmlCssinclude.py. In addition i found the reference to 'sample.css' and 'testdata' is not necessary for this package installation. So i also removed those reference. This help me to install package from local folder.

Categories

Resources