I have a system-level installation of Python 3.3.3, and I want to set up an installation in user space at /usr/local/python33 as part of a multi-version virtualenv-type setup. I made the directory, and I have attempted to use both easy_install and pip (as easy_install-3.3 and pip-3.3 from the system-level install) to put a copy of Python 3.3.3 there. No joy. The logs from both attempts are shown below. I thought this was supposed to be straightforward, but my confidence if flagging.
EASY_INSTALL
easy_install-3.3 --install-dir="/usr/local/python33" python==3.3.3
Creating /usr/local/python33/site.py
Searching for python==3.3.3
Reading https://pypi.python.org/simple/python/
Reading http://www.python.org
Reading http://www.python.org/2.3
Reading http://www.python.org/2.4
Reading http://www.python.org/2.4.1
Reading http://www.python.org/2.5
Reading http://www.python.org/download/
Best match: Python 3.3.3
Downloading http://www.python.org/ftp/python/3.3.3/Python-3.3.3.tgz
Processing Python-3.3.3.tgz
Writing /var/folders/l0/14nc8kh968l6kqp86s5ddxph0000gn/T/easy_install-3cjpwy/Python-3.3.3/setup.cfg
Running Python-3.3.3/setup.py -q bdist_egg --dist-dir /var/folders/l0/14nc8kh968l6kqp86s5ddxph0000gn/T/easy_install-3cjpwy/Python-3.3.3/egg-dist-tmp-3me0es
error: Setup script exited with error: Modules/Setup: No such file or directory
PIP
pip-3.3 install --target /usr/local/python33 python==3.3.3
You are installing a potentially insecure and unverifiable file. Future versions of pip will default to disallowing insecure files.
Downloading from URL http://www.python.org/ftp/python/3.3.3/Python-3.3.3.tgz (from http://www.python.org/download/)
Running setup.py egg_info for package python
running egg_info
creating pip-egg-info/Python.egg-info
writing dependency_links to pip-egg-info/Python.egg-info/dependency_links.txt
writing top-level names to pip-egg-info/Python.egg-info/top_level.txt
writing pip-egg-info/Python.egg-info/PKG-INFO
writing manifest file 'pip-egg-info/Python.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
reading manifest file 'pip-egg-info/Python.egg-info/SOURCES.txt'
writing manifest file 'pip-egg-info/Python.egg-info/SOURCES.txt'
Source in /private/var/folders/l0/14nc8kh968l6kqp86s5ddxph0000gn/T/pip_build_tipton/python has version 3.3.3, which satisfies requirement python==3.3.3
Installing collected packages: python
Running setup.py install for python
Running command /Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3 -c "import setuptools;__file__='/private/var/folders/l0/14nc8kh968l6kqp86s5ddxph0000gn/T/pip_build_tipton/python/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/l0/14nc8kh968l6kqp86s5ddxph0000gn/T/pip-x_pk9r-record/install-record.txt --single-version-externally-managed --home=/var/folders/l0/14nc8kh968l6kqp86s5ddxph0000gn/T/tmpf4gi0e
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: -c --help [cmd1 cmd2 ...]
or: -c --help-commands
or: -c cmd --help
error: option --single-version-externally-managed not recognized
Both easy_install and pip are for installing Python packages, not for installing Python itself.
How you install Python depends on your operating system. For Unices you typically run the standard configure; make; make install.
Related
I cannot install psycopg2 on my M1 Mac and I used pip3.
When I tried to install with pip3 install psycopg2 The output like that:
ERROR: Command errored out with exit status 1:
command: /opt/homebrew/opt/python#3.9/bin/python3.9 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-install-9wiqe2nr/psycopg2_147a5ae8fd5a47079480274f4225edbf/setup.py'"'"'; __file__='"'"'/private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-install-9wiqe2nr/psycopg2_147a5ae8fd5a47079480274f4225edbf/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 /private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-pip-egg-info-06hnnl2t
cwd: /private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-install-9wiqe2nr/psycopg2_147a5ae8fd5a47079480274f4225edbf/
Complete output (23 lines):
running egg_info
creating /private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-pip-egg-info-06hnnl2t/psycopg2.egg-info
writing /private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-pip-egg-info-06hnnl2t/psycopg2.egg-info/PKG-INFO
writing dependency_links to /private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-pip-egg-info-06hnnl2t/psycopg2.egg-info/dependency_links.txt
writing top-level names to /private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-pip-egg-info-06hnnl2t/psycopg2.egg-info/top_level.txt
writing manifest file '/private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-pip-egg-info-06hnnl2t/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>).
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/fd/ae/98cb7a0cbb1d748ee547b058b14604bd0e9bf285a8e0cc5d148f8a8a952e/psycopg2-2.8.6.tar.gz#sha256=fb23f6c71107c37fd667cb4ea363ddeb936b348bbd6449278eb92c189699f543 (from https://pypi.org/simple/psycopg2/) (requires-python:>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Using cached psycopg2-2.8.5.tar.gz (380 kB)
ERROR: Command errored out with exit status 1:
command: /opt/homebrew/opt/python#3.9/bin/python3.9 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-install-9wiqe2nr/psycopg2_97efcf6747c249769acdc8430ba4238f/setup.py'"'"'; __file__='"'"'/private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-install-9wiqe2nr/psycopg2_97efcf6747c249769acdc8430ba4238f/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 /private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-pip-egg-info-ap2am61r
cwd: /private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-install-9wiqe2nr/psycopg2_97efcf6747c249769acdc8430ba4238f/
Complete output (23 lines):
running egg_info
creating /private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-pip-egg-info-ap2am61r/psycopg2.egg-info
writing /private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-pip-egg-info-ap2am61r/psycopg2.egg-info/PKG-INFO
writing dependency_links to /private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-pip-egg-info-ap2am61r/psycopg2.egg-info/dependency_links.txt
writing top-level names to /private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-pip-egg-info-ap2am61r/psycopg2.egg-info/top_level.txt
writing manifest file '/private/var/folders/m5/vhnyyjg16gd352x6wdhpjysh0000gn/T/pip-pip-egg-info-ap2am61r/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>).
==============================================================================
Its beginning of the error, After that its tried to install each previous version of Psycopg
==============================================================================
Also, I tried to install with source code with :
git clone https://github.com/psycopg/psycopg2.git
cd psycopg2
python3 setup.py build
Its return as error like that:
running build
running build_py
running build_ext
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>).
Also
python3 setup.py build
return the same error as python3 setup.py build
How can I install it?
try this:
brew install libpq --build-from-source
brew install openssl
export LDFLAGS="-L/opt/homebrew/opt/openssl#1.1/lib -L/opt/homebrew/opt/libpq/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl#1.1/include -I/opt/homebrew/opt/libpq/include"
pip3 install psycopg2
Before reverting to any of the older answers, I would recommend trying the following:
Install Postgres using brew install postgres, then pip3 install psycopg2.
Worked on Mac M1, Monterey, Python 3.9.
Thanks to Kori Vernon.
Thanks to active development, now there is a new release of psycopg2 as well as psycopg2-binary which is compatible with M1 devices.
Ver. 2.9.1 works smooth. Tried and tested
Reference - https://github.com/psycopg/psycopg2/issues/1200
Following this steps solved my problem:
❯ brew install postgresql#14
# If you open a new terminal tab you will see that pg_config is available
❯ export CPPFLAGS="-I/opt/homebrew/opt/openssl#1.1/include"
❯ export LDFLAGS="-L/opt/homebrew/opt/openssl#1.1/lib -L${HOME}/.pyenv/versions/3.10.7/lib" # use your current python version
❯ python -V
Python 3.10.7 # make sure it matches the same above configuration
❯ pip install psycopg2-binary==2.8.5
This question already has answers here:
Error: pg_config executable not found when installing psycopg2 on Alpine in Docker
(5 answers)
Closed 2 years ago.
This is the error I get after I installed
RUN pip install -r requirements.txt
RROR: Service 'web' failed to build: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
➜ django-docker pip install psycopg2
Defaulting to user installation because normal site-packages is not writeable
Collecting psycopg2
Using cached psycopg2-2.8.6.tar.gz (383 kB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-7xuxd9cm/psycopg2/setup.py'"'"'; file='"'"'/tmp/pip-install-7xuxd9cm/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 /tmp/pip-pip-egg-info-uon18vv4
cwd: /tmp/pip-install-7xuxd9cm/psycopg2/
Complete output (23 lines):
running egg_info
creating /tmp/pip-pip-egg-info-uon18vv4/psycopg2.egg-info
writing /tmp/pip-pip-egg-info-uon18vv4/psycopg2.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-pip-egg-info-uon18vv4/psycopg2.egg-info/dependency_links.txt
writing top-level names to /tmp/pip-pip-egg-info-uon18vv4/psycopg2.egg-info/top_level.txt
writing manifest file '/tmp/pip-pip-egg-info-uon18vv4/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.
The error could be caused by the wrong operator on psycopy2-binary>==2.8 which according to pip docs should be >= and not >==
This might cause an error in parsing the requirements file.
I know there are a few questions on here and around the internet regarding parallel python builds using setuptools. Yet, none provide a solution. It's also worth mentioning that most I come across are 5+ years old.
It seems that I can achieve my desired parallelization during install through:
>> python setup.py build -j 4
>> python setup.py install
But this doesn't work for editable installations, i.e. for development. The editable install requires calling python setup.py develop instead of the above 2 commands. However, there is no -j flag for develop. If I try to call it after the build, for example,
>> python setup.py build -j 4
>> python setup.py develop
I get the error:
running develop
running egg_info
creating My_Package.egg-info
writing My_Package.egg-info/PKG-INFO
writing dependency_links to My_Package.egg-info/dependency_links.txt
writing top-level names to My_Package.egg-info/top_level.txt
writing manifest file 'My_Package.egg-info/SOURCES.txt'
reading manifest file 'My_Package.egg-info/SOURCES.txt'
writing manifest file 'My_Package.egg-info/SOURCES.txt'
running build_ext
copying build/lib.linux-x86_64-3.7_my_package_ext/_enums.cpython-37m-x86_64-linux-gnu.so _my_package_ext
error: could not create _my_package_ext/_enums.cpython-37m-x86_64-linux-gnu.so': No such file or directory
Additionally, it is recommended to use pip install -e . --user instead of python setup.py develop anyway. If I try to call that after the parallel build, I get:
>> python setup.py build -j 4
>> pip install -e . --user
Running setup.py (path:/package/setup.py) egg_info for package from file:///package
Running command python setup.py egg_info
running egg_info
writing My-Package.egg-info/PKG-INFO
writing dependency_links to My-Package.egg-info/dependency_links.txt
writing top-level names to My-Package.egg-info/top_level.txt
reading manifest file 'My-Package.egg-info/SOURCES.txt'
writing manifest file 'My-Package.egg-info/SOURCES.txt'
Source in /package has version 0.0, which satisfies requirement My-Package==0.0 from file:///package
Installing collected packages: My-Package
Running setup.py develop for My-Package
Running command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/package/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" develop --no-deps --user --prefix=
running develop
running egg_info
writing My-Package.egg-info/PKG-INFO
writing dependency_links to My-Package.egg-info/dependency_links.txt
writing top-level names to My-Package.egg-info/top_level.txt
reading manifest file 'My-Package.egg-info/SOURCES.txt'
writing manifest file 'My-Package.egg-info/SOURCES.txt'
running build_ext
copying build/lib.linux-x86_64-3.6/_my_package_ext/_enums.cpython-36m-x86_64-linux-gnu.so -> _my_package_ext
error: could not create '_my_package_ext/_enums.cpython-36m-x86_64-linux-gnu.so': No such file or directory
Cleaning up...
Command "/usr/bin/python3 -c "import setuptools, tokenize;__file__='/package/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" develop --no-deps --user --prefix=" failed with error code 1 in /package/
Does anyone know of a good way to get the parallelized build in an editable install? Ideally, it would be though the pip install -e ... formulations, but really anything would be better than nothing.
I have venv activated using conda
$source activate /home/sim/anaconda3/envs/myenv
I am in venv (myenv) sim#ma-Vostro-15-3568:~/flask/venv$
python3 -m pip install psycopg2
i have tried pip3 also
python --version is 3.6
Error is below
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1:
command: /home/mak/anaconda3/envs/myenv/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-7ql73mks/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-7ql73mks/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 /tmp/pip-install-7ql73mks/psycopg2/pip-egg-info
cwd: /tmp/pip-install-7ql73mks/psycopg2/
Complete output (23 lines):
running egg_info
creating /tmp/pip-install-7ql73mks/psycopg2/pip-egg-info/psycopg2.egg-info
writing /tmp/pip-install-7ql73mks/psycopg2/pip-egg-info/psycopg2.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-install-7ql73mks/psycopg2/pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing top-level names to /tmp/pip-install-7ql73mks/psycopg2/pip-egg-info/psycopg2.egg-info/top_level.txt
writing manifest file '/tmp/pip-install-7ql73mks/psycopg2/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
<http://initd.org/psycopg/docs/install.html>).
According to error message, you can either 1. specify path, or 2. install psycopg2-binary using the command: pip3 install psycopg2-binary
Try this
sudo apt install libpq-dev python3-dev
Get help from LINK
I have created a pypi package for educational purposes, and I wanted to do an upgrade. I did through the usual steps(do the changes, run setup.py etc)
but when I do:
python3 setup.py bdist_wheel
I am getting the error
python3 setup.py build bdist_wheel
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'bdist_wheel'
Wheel and pip are installed and up to date:
pip3 install wheel
Requirement already satisfied: wheel in /usr/local/lib/python3.4/dist-
packages (0.31.0)
The help of the command, does not seem to support bdist_wheel.
Am I missing something?
python3 setup.py --help-commands
Standard commands:
build build everything needed to install
build_py "build" pure Python modules (copy to build directory)
build_ext build C/C++ extensions (compile/link to build directory)
build_clib build C/C++ libraries used by Python extensions
build_scripts "build" scripts (copy and fixup #! line)
clean clean up temporary files from 'build' command
install install everything from build directory
install_lib install all Python modules (extensions and pure Python)
install_headers install C/C++ header files
install_scripts install scripts (Python or otherwise)
install_data install data files
sdist create a source distribution (tarball, zip file, etc.)
register register the distribution with the Python package index
bdist create a built (binary) distribution
bdist_dumb create a "dumb" built distribution
bdist_rpm create an RPM distribution
bdist_wininst create an executable installer for MS Windows
check perform some checks on the package
upload upload binary package to PyPI
Extra commands:
alias define a shortcut to invoke one or more commands
bdist_egg create an "egg" distribution
develop install package in 'development mode'
easy_install Find/get/install Python packages
egg_info create a distribution's .egg-info directory
install_egg_info Install an .egg-info directory for the package
rotate delete older distributions, keeping N newest files
saveopts save supplied options to setup.cfg or other config file
setopt set an option in setup.cfg or another config file
test run unit tests after in-place build
upload_docs Upload documentation to PyPI
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
EDIT:
python3 --version
Python 3.6.3
pip3 --version
pip 10.0.1 from /usr/local/lib/python3.4/dist-packages/pip (python 3.4)
Looks like pip version and python version didnt match...fixing this removed the problem.