python_setup.py and egg.info error while installing Django-toolbelt - django

I tried to install Django-toolbelt, but I keep getting the below. I am using Mac. I've tried googling around for solutions but no luck. Thanks.
(venv)Chans-MacBook-Pro:Django_app2 chantrinh$ pip install django-toolbelt
/Users/chantrinh/Django_app2/venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Collecting django-toolbelt
Using cached django-toolbelt-0.0.1.tar.gz
Collecting django (from django-toolbelt)
Using cached Django-1.8.1-py2.py3-none-any.whl
Collecting psycopg2 (from django-toolbelt)
Using cached psycopg2-2.6.tar.gz
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'
warning: manifest_maker: standard file '-c' not found
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'.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/4r/bh8wxz5d2678zg90jn1715s80000gn/T/pip-build-eUKfh5/psycopg2
(venv)Chans-MacBook-Pro:Django_app2 chantrinh$ pg_config
-bash: pg_config: command not found
(venv)Chans-MacBook-Pro:Django_app2 chantrinh$ sudo find / -name pg_config
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory

I had exactly the same error message. However, in my case, I had already installed psycopg2. What was happening was the following:
I had first to install Macports,
Then in the python documentation I got this line:
sudo port install py27-psycopg2
But that line installed the package in
'/opt/local/Library/Frameworks/Python.Framework/....'
instead of
'/Library/Frameworks/Python.Framework/....'
I just created a symbolic link to solve the problem.

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.

Error while attempting to pip install psycopg2==2.7.*

I'm trying to run the package, pip install psycopg2==2.7.* ,on my PyCharm terminal so I can deploy my site but I get the message that appears below
Collecting psycopg2
Using cached https://files.pythonhosted.org/packages/a8/8f/1c5690eebf148d1d1554fc00ccf9101e134636553dbb75bdfef4f85d7647/psycopg2-2.8.5.tar.gz
ERROR: Command errored out with exit status 1:
command: /Users/applecare/PycharmProjects/learning_log/11_env/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/w6/sqx_mjh176x08sjppl82f1l80000gn/T/pip-install-8j8wbzsu/psycopg2/setup.py'"'"'; __file__='"'"'/private/var/folders/w6/sqx_mjh176x08sjppl82f1l80000gn/T/pip-install-8j8wbzsu/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: /private/var/folders/w6/sqx_mjh176x08sjppl82f1l80000gn/T/pip-install-8j8wbzsu/psycopg2/
Complete output (23 lines):
running egg_info
creating pip-egg-info/psycopg2.egg-info
writing pip-egg-info/psycopg2.egg-info/PKG-INFO
writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
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.
For further information please check the 'doc/src/install.rst' file (also at
<https://www.psycopg.org/docs/install.html>).
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 19.2.3, however version 20.2.2 is available.
You should consider upgrading via the '`pip install --upgrade pip`' command.
If you are on Linux, you will need to install PostgreSQL to run your database and then to connect the clients to your PostgreSQL database you will need other packages like libpq-dev, libpq5.
You can install the above packages with the below commands.
sudo apt-get install postgresql
sudo apt-get install libpq5
sudo apt-get install libpq-dev
So if you’re on Mac, I can think of two ways:
pip install psycopg2-binary
Install PostgreSQL with brew or the excellent postgre.app and point the path to pg_config binary (this is actually the error you’re getting)
On Mac I did brew install postgresql and it did the trick for me

dlib is not installing in pythonanywhere virtualenv

I am trying to recognize faces in an image using "face_recognition" library,to use it we have to install dlib but when installing dlib in pythonanywhere virtualenv console it is throwing some errors
below is the error I got during installation of dlib
(env) 16:09 ~/dlib (master)$ python setup.py install --yes
USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA
running install
running bdist_egg
running egg_info
creating dlib.egg-info
writing dlib.egg-info/PKG-INFO
writing top-level names to dlib.egg-info/top_level.txt
writing dependency_links to dlib.egg-info/dependency_links.txt
writing manifest file 'dlib.egg-info/SOURCES.txt'
package init file 'dlib/__init__.py' not found (or not a regular file)
reading manifest file 'dlib.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'dlib.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
error: [Errno 38] Function not implemented
It looks like there's some strange problem with the current version of dlib that's stopping it from installing on PythonAnywhere. Version 19.3.1 seems to work:
pip2.7 install --user dlib==19.3.1
pip install https://pypi.python.org/packages/da/06/bd3e241c4eb0a662914b3b4875fc52dd176a9db0d4a2c915ac2ad8800e9e/dlib-19.7.0-cp36-cp36m-win_amd64.whl#md5=b7330a5b2d46420343fbed5df69e6a3f
Try installing from this cmd command, assuming that you have already added pip in path

Error when install psycopg2 on mac

When i try to install psycopg2 on mac using pip install -r requirements.txt
I got error.
Collecting psycopg2==2.6 (from -r requirements.txt (line 30))
Using cached psycopg2-2.6.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/psycopg2.egg-info
writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
writing pip-egg-info/psycopg2.egg-info/PKG-INFO
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.1'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/r6/0rwq93rx6n59lbn8jrng11gm0000gn/T/pip-build-hat1f3jy/psycopg2/
I could not solve it.python3.4.3 mac10.12
could anyone suggest any solution?
The issue you are running into here is that psycopg2 isn't compatible with Postgres 10 unless you use version 2.7 or higher.
So either you will need to install an earlier version of postgres or port whichever package you are trying to install to psycopg2 2.7.x
The relevant issue that was resolved in version 2.7 can be found here
https://github.com/psycopg/psycopg2/issues/489

Install psycopg2 on Synology

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.