So when I am trying to install cryptography via
python -m pip install cryptography
I get two error messages coming back:
Failed building wheel for cryptography
command "/usr/local/bin/python -c "import setuptools, tokenize;file='/private/var/folders/qf/57zhxjfn4hl95y8xg7l12xpm0000gn/T/pip-build-DBR7_Y/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /var/folders/qf/57zhxjfn4hl95y8xg7l12xpm0000gn/T/pip-msQ3gT-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/qf/57zhxjfn4hl95y8xg7l12xpm0000gn/T/pip-build-DBR7_Y/cryptography
Any ideas on how to fix this problem?
Like in your other post Trouble with running pip install
run your same command with sudo
may be its dependecies hang on your netword, you could install them first
in my case, it depend on idna, enum34, ipaddress, pycparser, so
pip install idna enum34 ipaddress pycparser
and then install cryptography
`pip install cryptography`
how to know cryptography's dependecies?
cryptography's dependecies depend on system environment, when it hang on, you can find the log like this, first line is its dependecies.
Installing collected packages: cryptography, idna, enum34, ipaddress, pycparser
Running setup.py install for cryptography
warning: no previously-included files matching 'yacctab.*' found under directory 'tests'
warning: no previously-included files matching 'lextab.*' found under directory 'tests'
warning: no previously-included files matching 'yacctab.*' found under directory 'examples'
warning: no previously-included files matching 'lextab.*' found under directory 'examples'
zip_safe flag not set; analyzing archive contents...
In my case, I was running an old version of pip, getting this error message:
You are using pip version 7.1.0, however version 8.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
I simply updated to the newest version, I had no trouble installing:
pip install --upgrade pip
Related
Please see my previous question here. I have spent all day searching on what my issues are and still running into pip install issues. This time my error message is a little different. What I have done since my previous post:
Made sure that C:\mysys64\mingw64\bin was added to my path under system environment variables
edit the c_cpp_properties.json specifically the "intelliSenseMode" in VSCode from "windows-msvc-x64" to "windows-gcc-x64"
re-check my Python.h file under directory C:\msys64\mingw64\include\python3.9\Python.h to make sure the errors were gone by the #include <unistd.h> which they were.
Retry pip install Flask-SQLAlchemy and now I get the following errors...
Terminal window output
Using cached Flask_SQLAlchemy-2.5.1-py2.py3-none-any.whl (17 kB)
Collecting SQLAlchemy>=0.8.0
Using cached SQLAlchemy-1.4.29.tar.gz (8.0 MB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: Flask>=0.10 in c:\msys64\mingw64\lib\python3.9\site-packages (from Flask-SQLAlchemy) (2.0.2)
Requirement already satisfied: itsdangerous>=2.0 in c:\msys64\mingw64\lib\python3.9\site-packages (from Flask>=0.10->Flask-SQLAlchemy) (2.0.1)
Requirement already satisfied: Jinja2>=3.0 in c:\msys64\mingw64\lib\python3.9\site-packages (from Flask>=0.10->Flask-SQLAlchemy) (3.0.3)
Requirement already satisfied: click>=7.1.2 in c:\msys64\mingw64\lib\python3.9\site-packages (from Flask>=0.10->Flask-SQLAlchemy) (8.0.3)
Requirement already satisfied: Werkzeug>=2.0 in c:\msys64\mingw64\lib\python3.9\site-packages (from Flask>=0.10->Flask-SQLAlchemy) (2.0.2)
Collecting greenlet!=0.4.17
Using cached greenlet-1.1.2.tar.gz (91 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: colorama in c:\msys64\mingw64\lib\python3.9\site-packages (from click>=7.1.2->Flask>=0.10->Flask-SQLAlchemy) (0.4.4)
Requirement already satisfied: MarkupSafe>=2.0 in c:\msys64\mingw64\lib\python3.9\site-packages (from Jinja2>=3.0->Flask>=0.10->Flask-SQLAlchemy) (2.0.1)
Building wheels for collected packages: SQLAlchemy, greenlet
Building wheel for SQLAlchemy (setup.py) ... done
Created wheel for SQLAlchemy: filename=SQLAlchemy-1.4.29-cp39-cp39-win_amd64.whl size=1512539 sha256=80ef3cf51b84f92e8117a57097054fcb25807ebf7755115d7df299bacf17a09d
Stored in directory: c:\users\t\appdata\local\pip\cache\wheels\6d\94\a6\8bdac6f92ce851f71a9fa62934a06cf2b654700b5f258242c7
Building wheel for greenlet (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\msys64\mingw64\bin\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\t\\AppData\\Local\\Temp\\pip-install-p182wkp5\\greenlet_78bb1f8ef93a452d8f0a86edfe24f6dd\\setup.py'"'"'; __file__='"'"'C:\\Users\\t\\AppData\\Local\\Temp\\pip-install-p182wkp5\\greenlet_78bb1f8ef93a452d8f0a86edfe24f6dd\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\t\AppData\Local\Temp\pip-wheel-iwgszyll'
cwd: C:\Users\t\AppData\Local\Temp\pip-install-p182wkp5\greenlet_78bb1f8ef93a452d8f0a86edfe24f6dd\
Complete output (69 lines):
Then some other errors like so
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\msys64\mingw64\include -IC:\msys64\mingw64\include\python3.9 "-IC:\Program
Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\cppwinrt" /Tcsrc/greenlet/greenlet.c /Fobuild\temp.win-amd64-3.9\Release\src/greenlet/greenlet.obj
greenlet.c
C:\msys64\mingw64\include\python3.9\Python.h(36): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory
error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.30.30705\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Failed building wheel for greenlet
Running setup.py clean for greenlet
Successfully built SQLAlchemy
Failed to build greenlet
Installing collected packages: greenlet, SQLAlchemy, Flask-SQLAlchemy
Running setup.py install for greenlet ... error
ERROR: Command errored out with exit status 1:
However there is no longer a squiggly error line under #include <unistd.h> in my Python.h file. Mind you I have no clue what I am doing in trying to fix this. Please let me know if there is a solution.
Update 2022.02.01: I have unistalled version 3.9.7 of python and installed version 3.10.2. I have updated pip to version 22.02.2 and have tried the solutions given below. After downloading the wheels greenlet‑1.1.2‑cp310‑cp310‑win32.whl and greenlet‑1.1.2‑cp310‑cp310‑win_amd64.whl I went to my downloads folder and ran the commands and follows:
C:\Users\t\Downloads>C:\msys64\mingw64\bin\python.exe -m pip install greenlet-1.1.2-cp310-cp310-win_amd64.whl
ERROR: greenlet-1.1.2-cp310-cp310-win_amd64.whl is not a supported wheel on this platform.
C:\Users\t\Downloads>C:\msys64\mingw64\bin\python.exe -m pip install greenlet-1.1.2-cp310-cp310-win32.whl
ERROR: greenlet-1.1.2-cp310-cp310-win32.whl is not a supported wheel on this platform.
After that didnt work I tried to pip install greenlet directly with pip install greenlet and got the following output:
Building wheels for collected packages: greenlet
Building wheel for greenlet (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [69 lines of output]
and further down
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for greenlet
Running setup.py clean for greenlet
Failed to build greenlet
Installing collected packages: greenlet
Running setup.py install for greenlet ... error
error: subprocess-exited-with-error
× Running setup.py install for greenlet did not run successfully.
│ exit code: 1
╰─> [71 lines of output]
and yet further down (hoping this may shine some light on the problem)
error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.30.30705\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> greenlet
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Following commands solved the issue on my m1 Mac -
- brew install graphviz
- python3 -m pip install \
--global-option=build_ext \
--global-option="-I$(brew --prefix graphviz)/include/" \
--global-option="-L$(brew --prefix graphviz)/lib/" \
pygraphviz
You can simply download an appropriate whl file from here and install it.
For you greenlet‑1.1.2‑cp39‑cp39‑win_amd64.whl should be correct. After downloading, cd to your download directory and run
C:\msys64\mingw64\bin\python.exe -m pip install greenlet‑1.1.2‑cp39‑cp39‑win_amd64.whl
Then try your original installation again.
Note
There is also a whl file for Flask_SQLAlchemy‑2.5.1‑py3‑none‑any.whl available on the same website. You could also download and install that
The pip in the py -m pip is different from the pip in the pip list. You can through py -m pip --version and pip --version to get the pip locations.
I can install the greenlet package successfully through:
pip install greenlet --no-cache-dir
I am using python310, It looks like have some problems with python39. If it does not work, as #FlyingTeller has suggested, you can download it manually.
As you described greenlet-1.1.2-cp39-cp39-win_amd64.whl does not work, so have you tried greenlet‑1.1.2‑cp39‑cp39‑win32.whl?
>>> import platform
>>> platform.architecture()
You can get architecture through the above codes.
I had issues to install greenlet 2.0.1 in PyCharm on Mac M1.
I've upgraded:
pip install --upgrade pip
pip install --upgrade setuptools wheel
And thanks to #joydeba comment - I've installed Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
*Follow the instructions at the end of installation
After these steps I was able to install greenlet in PyCharm with no problem!
I updated pip, setuptools and wheel and it it solved the problem.
pip install --upgrade pip
pip install --upgrade setuptools wheel
note: if your pip is aliased as pip3 (Python 3) use pip3 instead of pip
pip3 install --upgrade pip
pip3 install --upgrade setuptools wheel
refer to this link for more information:
https://bobbyhadz.com/blog/python-error-legacy-install-failure
Installing cffi in the virtual environment encounters errors, but seems to install. Are these errors actually critical, ones that could lead it to fail when installing cryptography (see further below)?
pip install cffi==1.11.5
Downloading/unpacking cffi==1.11.5
Downloading cffi-1.11.5.tar.gz (438kB): 438kB downloaded
Running setup.py (path:/[venv-install-directory]/build/cffi/setup.py) egg_info for package cffi
Downloading/unpacking pycparser (from cffi==1.11.5)
Downloading pycparser-2.18.tar.gz (245kB): 245kB downloaded
Running setup.py (path:/[venv-install-directory]/build/pycparser/setup.py) egg_info for package pycparser
warning: no previously-included files matching 'yacctab.' found under directory 'tests'
warning: no previously-included files matching 'lextab.' found under directory 'tests'
warning: no previously-included files matching 'yacctab.' found under directory 'examples'
warning: no previously-included files matching 'lextab.' found under directory 'examples'
Installing collected packages: cffi, pycparser
Running setup.py install for cffi
building '_cffi_backend' extension
gcc -pthread -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/local/lib/libffi-3.2.1/include -I/[venv-install-directory]/include -I/usr/local/include/python3.4m -c c/_cffi_backend.c -o build/temp.linux-i686-3.4/c/_cffi_backend.o
gcc -pthread -shared build/temp.linux-i686-3.4/c/_cffi_backend.o -L/usr/local/lib -lffi -o build/lib.linux-i686-3.4/_cffi_backend.cpython-34m.so
Could not find .egg-info directory in install record for cffi==1.11.5
Running setup.py install for pycparser
warning: no previously-included files matching 'yacctab.' found under directory 'tests'
warning: no previously-included files matching 'lextab.' found under directory 'tests'
warning: no previously-included files matching 'yacctab.' found under directory 'examples'
warning: no previously-included files matching 'lextab.' found under directory 'examples'
Build the lexing/parsing tables
Could not find .egg-info directory in install record for pycparser (from cffi==1.11.5)
Successfully installed cffi pycparser
Cleaning up...
This problem is perplexing because it works on my local system, but when creating a virtual environment, the following error occurs during the attempted install of cryptography:
File "[path-to-venv]/build/cryptography/src/_cffi_src/utils.py", line 57, in build_ffi
ffi = FFI()
File "[path-to-venv]/lib/python3.4/site-packages/cffi/api.py", line 46, in __init__
import _cffi_backend as backend
ImportError: [path-to-venv]/lib/python3.4/site-packages/_cffi_backend.cpython-34m.so: undefined symbol: __syscall_error
A virtual environment literally creates a copy of the local environment, doesn't it?
So how is "_cffi_backend" not working in the virtual environment, when there's no problem on the system install itself? I don't see how this could happen in the first place.
Has anyone successfully dealt with a problem like this one? If you have ideas or a solution, please be specific since I've already spent quite a few hours trying solutions that haven't worked so far.
Among other things, I've already tried compiling and installing libffi from source before creating the virtual environment: https://sourceware.org/libffi/
Are there other alternatives for creating virtual environments that don't require re-installing every package -- i.e. where can just use your existing installed setup and copy it directly into the virtual environment (or a similar way that avoids falling into dependency hell)?
This seems like a simple issue to solve once you have a grasp of the actual problem. If I can't figure this out, I can't deploy my project since it crucially depends on cryptography. So thanks in advance for any ideas you might have that could help fix this issue.
The answer in this case was to upgrade pip -- inside the virtual environment.
Complete instructions:
create the virtual environment.
python3.4 -m venv [venv_name_here]
enter the virtual environment.
cd [venv_name_here]
activate the virtual environment.
source bin/activate
4. upgrade pip.
pip install --upgrade pip
install setuptools.
pip install setuptools==39.1.0
install pyparser.
pip install pyparser==1.0
pip install pyparsing==2.1.0
install cffi.
pip install cffi==1.11.5
install cryptography.
pip install cryptography==2.2.2
Completes installation perfectly, with no errors.
Note that you may need to change version numbers, depending on the output of the "pip freeze" command (i.e. look at your 'requirements.txt' file):
pip freeze -l > requirements.txt
I was installing scipy for theano in virtualenv, it fails right after the start the installation. And it says it fails with error code -11. Could anyone can help me with this, what is the error code 11?
Here is the full trace of the error, from the beginning of when I run the command:
(dl)[haohan#sirius deeplearning]$ pip install theano
Requirement already satisfied (use --upgrade to upgrade): theano in ./dl/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.5.0 in ./dl/lib/python2.7/site- packages (from theano)
Downloading/unpacking scipy>=0.7.2 (from theano)
Downloading scipy-0.14.0.tar.gz (10.2MB): 10.2MB downloaded
Running setup.py (path:/home/haohan/deeplearning/dl/build/scipy/setup.py) egg_info for package scipy
warning: no previously-included files matching '*_subr_*.f' found under directory 'scipy/linalg/src/id_dist/src'
no previously-included directories found matching 'scipy/special/tests/data/boost'
no previously-included directories found matching 'scipy/special/tests/data/gsl'
no previously-included directories found matching 'doc/build'
no previously-included directories found matching 'doc/source/generated'
no previously-included directories found matching '*/__pycache__'
warning: no previously-included files matching '*~' found anywhere in distribution
warning: no previously-included files matching '*.bak' found anywhere in distribution
warning: no previously-included files matching '*.swp' found anywhere in distribution
warning: no previously-included files matching '*.pyo' found anywhere in distribution
Installing collected packages: scipy
Running setup.py install for scipy
Cleaning up...
Command /home/haohan/deeplearning/dl/bin/python -c "import setuptools, tokenize;__file__='/home/haohan/deeplearning/dl/build/scipy/setup.py';
exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))"
install --record /tmp/pip-svx8Wr-record/install-record.txt --single-version-externally-managed --compile --install-headers
/home/haohan/deeplearning/dl/include/site/python2.7 failed with error code -11 in /home/haohan/deeplearning/dl/build/scipy
Storing debug log for failure in /home/haohan/.pip/pip.log
I break the second last line into several lines, for the convenience of reading.
I think this is very strange that the error occurs barely after the installation starts and I have just use pip to install numpy successfully, so it's unlikely to be the problem of pip. Then, where is the problem? How should I fix it?
Could it be related with the system? But I guess I cannot print the system information out since I don't have sudo permission...
Could it because that our cluster is too old? That's the only explanation that I can think of.
Thanks a lot!
Have you tried updating setuptools?
pip install --upgrade setuptools
Then try installing theano again.
When I encountered this problem while developing my own package, the root cause was with imports in setup.py. I changed what setup.py imported and then it worked. Maybe theano's setup is importing a package which has an incompatible version?
If the problem isn't solved by updating packages or editing imports in setup, you can try to debug by using the vvv flag to get more information, as in pip install -vvv theano.
As for the error code you're seeing:
A negative value -N indicates that the child was terminated by signal
N (Unix only)
https://docs.python.org/3/library/subprocess.html#subprocess.Popen.returncode
Code 11 means segfault in *nix, although os.strerror(11) reports "Resource temporarily unavailable". Since I get segfaults when I attempt python setup.py egg_info, I'm betting it's the first (segfault) definition of 11 that's relevant.
If your segfault dumped a core, it's probably in /var/lib/systemd/coredump/ if you're using systemd.
https://unix.stackexchange.com/a/349433/183163
If you can't find a core, check ulimit -c. If it reports 0, run ulimit -c unlimited to enable core dumping. You can get the full path to the most recent dump file by ls -rtd /var/lib/systemd/coredump/* | tail -1
To read the dump, you can use gdb. For example:
gdb python /var/lib/systemd/coredump/core.python.6146.f06ba728dae74cfbbaf80acb8d392dd5.4477.1524677641000000.lz4
i've followed this tutorial reached to Step 5: Set up pyapns
when trying to install pypans: sudo pip install pypans i get the error
Downloading/unpacking pypans
Could not find any downloads that satisfy the requirement pypans
Cleaning up…
No distributions at all found for pypans
googling pypans there are two libraries in Github one of djacobs / PyAPNs and another by samuraisam / pyapns sinse the later install is sudo easy_install pyapns i’ve choose it but again error occurs:
Searching for pyapns
Reading http://pypi.python.org/simple/pyapns/
Best match: pyapns 0.4.0
Downloading https://pypi.python.org/packages/source/p/pyapns/pyapns-0.4.0.tar.gz#md5=7cf327e794ed875103ac7cae4a26d41e
Processing pyapns-0.4.0.tar.gz
Running pyapns-0.4.0/setup.py -q bdist_egg –dist-dir /tmp/easy_install-mrRYFC/pyapns-0.4.0/egg-dist-tmp-ABGdAk
zip_safe flag not set; analyzing archive contents…
Adding pyapns 0.4.0 to easy-install.pth file
Installed /usr/local/lib/python2.7/dist-packages/pyapns-0.4.0-py2.7.egg
Processing dependencies for pyapns
Searching for pyOpenSSL>=0.10
Reading http://pypi.python.org/simple/pyOpenSSL/
Best match: pyOpenSSL 0.13.1
Downloading https://pypi.python.org/packages/source/p/pyOpenSSL/pyOpenSSL-0.13.1.tar.gz#md5=e27a3b76734c39ea03952ca94cc56715
Processing pyOpenSSL-0.13.1.tar.gz
Running pyOpenSSL-0.13.1/setup.py -q bdist_egg –dist-dir /tmp/easy_install-FWlyHp/pyOpenSSL-0.13.1/egg-dist-tmp-6OVz0I
warning: no previously-included files matching ‘*.pyc’ found anywhere in distribution
OpenSSL/crypto/crypto.c:14:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: Setup script exited with error: command ‘gcc’ failed with exit status 1
i've tried installing twisted sudo apt-get install twisted ended in this error
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package twisted
same goes for sudo easy_install PyOpenSSL
Searching for PyOpenSSL
Reading http://pypi.python.org/simple/PyOpenSSL/
Best match: pyOpenSSL 0.13.1
Downloading https://pypi.python.org/packages/source/p/pyOpenSSL/pyOpenSSL-0.13.1.tar.gz#md5=e27a3b76734c39ea03952ca94cc56715
Processing pyOpenSSL-0.13.1.tar.gz
Running pyOpenSSL-0.13.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-cxQRwv/pyOpenSSL-0.13.1/egg-dist-tmp-3Pg5hl
warning: no previously-included files matching '*.pyc' found anywhere in distribution
OpenSSL/crypto/crypto.c:14:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: Setup script exited with error: command 'gcc' failed with exit status 1
what am i doing wrong
is there a good working simple python push notification step by step tutorial?
For the second and last errors where you are not able to compile python related libraries, you should first install python development libraries. Since you have already used apt-get, here's the package you need:
$ sudo apt-get install python-dev
UPDATE: When installing both packages using setup.py alone they install just fine. When extracting the tarballs generated by sdist and installing them the same error occurs. This means that the problem is somewhere inside setuptools I guess.
I developed two projects that have two namespace packages: testsuite and testsuite.prettyprint.
Both of these namespace packages' __init__.py contain:
__import__('pkg_resources').declare_namespace(__name__)
Here's the setup.py for testsuite.prettyprint.outcomes:
import pkgutil
from setuptools import setup
def get_packages():
return [name for _, name, is_package in pkgutil.walk_packages('.') if name.startswith('testsuite') and is_package]
dependencies = ['nose2>=0.4.6', 'colorama>=0.2.5']
setup(
name='testsuite-prettyprint-outcomes',
version='0.1.0-alpha.1',
packages=get_packages(),
url='',
license='BSD3',
author='Omer Katz',
author_email='omer.drow#gmail.com',
description='testsuite-prettyprint-outcomes is a nose2 plugin that prettyprints test outcomes.',
namespace_packages=['testsuite', 'testsuite.prettyprint'],
install_requires=dependencies
)
and here is the setup.py for testsuite.prettyprint.traceback:
import pkgutil
import sys
from setuptools import setup
def get_packages():
return [name for _, name, is_package in pkgutil.walk_packages('.') if name.startswith('testsuite') and is_package]
dependencies = ['nose2>=0.4.6', 'pygments>=1.6']
if sys.platform == 'win32':
dependencies.append('colorama>=0.2.5')
setup(
name='testsuite-prettyprint-traceback',
version='0.1.0-alpha.2',
packages=get_packages(),
url='',
license='BSD3',
author='Omer Katz',
author_email='omer.drow#gmail.com',
description='testsuite-prettyprint-traceback is a nose2 plugin that prettyprints traceback on failures and errors.',
namespace_packages=['testsuite', 'testsuite.prettyprint'],
install_requires=dependencies
)
When installing them both it refuses to install one:
pip install testsuite-prettyprint-outcomes testsuite-prettyprint-traceback --use-mirrors
Downloading/unpacking testsuite-prettyprint-outcomes
Downloading testsuite-prettyprint-outcomes-0.1.0-alpha.1.tar.gz
Running setup.py egg_info for package testsuite-prettyprint-outcomes
Downloading/unpacking testsuite-prettyprint-traceback
Downloading testsuite-prettyprint-traceback-0.1.0-alpha.2.tar.gz
Running setup.py egg_info for package testsuite-prettyprint-traceback
Downloading/unpacking nose2>=0.4.6 (from testsuite-prettyprint-outcomes)
Running setup.py egg_info for package nose2
warning: no previously-included files matching '__pycache__' found anywhere in distribution
warning: no previously-included files matching '*~' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
Downloading/unpacking colorama>=0.2.5 (from testsuite-prettyprint-outcomes)
Downloading colorama-0.2.5.zip
Running setup.py egg_info for package colorama
Downloading/unpacking pygments>=1.6 (from testsuite-prettyprint-traceback)
Downloading Pygments-1.6.tar.gz (1.4MB): 1.4MB downloaded
Running setup.py egg_info for package pygments
Downloading/unpacking six>=1.1,<1.2 (from nose2>=0.4.6->testsuite-prettyprint-outcomes)
Running setup.py egg_info for package six
Installing collected packages: testsuite-prettyprint-outcomes, testsuite-prettyprint-traceback, nose2, colorama, pygments, six
Running setup.py install for testsuite-prettyprint-outcomes
Skipping installation of /home/omer/.virtualenvs/test/lib/python3.2/site-packages/testsuite/__init__.py (namespace package)
Skipping installation of /home/omer/.virtualenvs/test/lib/python3.2/site-packages/testsuite/prettyprint/__init__.py (namespace package)
Installing /home/omer/.virtualenvs/test/lib/python3.2/site-packages/testsuite_prettyprint_outcomes-0.1.0_alpha.1-py3.2-nspkg.pth
Running setup.py install for testsuite-prettyprint-traceback
error: package directory 'testsuite/prettyprint/outcomes' does not exist
Complete output from command /home/omer/.virtualenvs/test/bin/python3.2 -c "import setuptools;__file__='/home/omer/.virtualenvs/test/build/testsuite-prettyprint-traceback/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-12l9lq-record/install-record.txt --single-version-externally-managed --install-headers /home/omer/.virtualenvs/test/include/site/python3.2:
running install
running build
running build_py
creating build
creating build/lib
creating build/lib/testsuite
copying testsuite/__init__.py -> build/lib/testsuite
creating build/lib/testsuite/prettyprint
copying testsuite/prettyprint/__init__.py -> build/lib/testsuite/prettyprint
error: package directory 'testsuite/prettyprint/outcomes' does not exist
----------------------------------------
Command /home/omer/.virtualenvs/test/bin/python3.2 -c "import setuptools;__file__='/home/omer/.virtualenvs/test/build/testsuite-prettyprint-traceback/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-12l9lq-record/install-record.txt --single-version-externally-managed --install-headers /home/omer/.virtualenvs/test/include/site/python3.2 failed with error code 1 in /home/omer/.virtualenvs/test/build/testsuite-prettyprint-traceback
Storing complete log in /home/omer/.pip/pip.log
I can't figure out what is wrong. Even if you change the order of installation it says it can't find the other.
After installing one of your packages and downloading the other…
You're not including testsuite/__init__.py and testsuite/prettyprint/__init__.py in the source files.
The docs on Namespace Packages the setuptools/pkg_resources way explains:
Note, by the way, that your project's source tree must include the namespace packages' __init__.py files (and the __init__.py of any parent packages), in a normal Python package layout.
If you don't actually install these files, they don't do any good. You just end up with a testsuite with nothing in it but prettyprint, and that has nothing in it but outcomes, so testsuite and testsuite.prettyprint are not packages at all, much less namespace packages.
The names of your packages look wrong. I just separated a project out into subpackages, and one thing I did differently was to make each name match the components of the namespace_packages.
So, for testsuite.prettyprint.outcomes:
setup(
name='testsuite.prettyprint.outcomes',
[...] ,
namespace_packages=['testsuite', 'testsuite.prettyprint']
)
And for testsuite.prettyprint.traceback:
setup(
name='testsuite.prettyprint.traceback',
[...] ,
namespace_packages=['testsuite', 'testsuite.prettyprint']
)
For this to work properly, you'll need to provide __init__.py scripts, like you've already shown, for all the parent namespace_package levels (i.e. down to testsuite.prettyprint).
Good examples of namespace_packages in production packages can be found in the zope sub-packages.
e.g. See the zope.app.cache setup.py script, at http://svn.zope.org/zope.app.cache/trunk/setup.py?view=markup
I see you are using virtualenv. Usually when I encounter that error your are facing is because the packages don't work well with virtualenv.
Have you tried installing the packages on your main python install folder? (not in virtualenv)
I think this happens because some setup.py files make assumptions about the host environment and don't follow the setup.py best practices.
If you are still stuck give it a try.