Cannot install two packages that use the same namespace - python

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.

Related

Unable to instal django-heroku on mac

I am trying to host a Django app on Heroku. The app works fine on my computer as long as I don't use django-heroku (because I can't install it), and it works fine on Heroku as long as it does have django-heroku. This is not a pressing issue, but it is sort of annoying to have to remove django-heroku to make edits on my computer, and then have to re-insert it before pushing to heroku.
The ideal solution would be to get django-heroku installed on my computer.
Specifications:
Mac running macOS
Conda environment, python 3.7 and 3.8
Here is what I have found so far:
pip 20.0.2 from /Users/lucas/opt/anaconda3/lib/python3.7/site-packages/pip (python 3.7):
Cannot install django-heroku (See error below)
pip 20.1.1 from /Users/lucas/Library/Python/3.7/lib/python/site-packages/pip (python 3.7):
Can install django-heroku, however:
Gives me this warning: (still installs without any problems)
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
running the script with all pythons in the environment say no module called django_heroku
The first version of pip I specified that couldn't install django-heroku gives this error:
pip install django-heroku
Collecting django-heroku
Using cached django_heroku-0.3.1-py2.py3-none-any.whl (6.2 kB)
Collecting psycopg2
Using cached psycopg2-2.8.5.tar.gz (380 kB)
ERROR: Command errored out with exit status 1:
command: /Users/lucas/opt/anaconda3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/r1/c30g6kr946l2czzpkr2mvrd80000gn/T/pip-install-q1m4s1hh/psycopg2/setup.py'"'"'; __file__='"'"'/private/var/folders/r1/c30g6kr946l2czzpkr2mvrd80000gn/T/pip-install-q1m4s1hh/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 /private/var/folders/r1/c30g6kr946l2czzpkr2mvrd80000gn/T/pip-install-q1m4s1hh/psycopg2/pip-egg-info
cwd: /private/var/folders/r1/c30g6kr946l2czzpkr2mvrd80000gn/T/pip-install-q1m4s1hh/psycopg2/
Complete output (23 lines):
running egg_info
creating /private/var/folders/r1/c30g6kr946l2czzpkr2mvrd80000gn/T/pip-install-q1m4s1hh/psycopg2/pip-egg-info/psycopg2.egg-info
writing /private/var/folders/r1/c30g6kr946l2czzpkr2mvrd80000gn/T/pip-install-q1m4s1hh/psycopg2/pip-egg-info/psycopg2.egg-info/PKG-INFO
writing dependency_links to /private/var/folders/r1/c30g6kr946l2czzpkr2mvrd80000gn/T/pip-install-q1m4s1hh/psycopg2/pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing top-level names to /private/var/folders/r1/c30g6kr946l2czzpkr2mvrd80000gn/T/pip-install-q1m4s1hh/psycopg2/pip-egg-info/psycopg2.egg-info/top_level.txt
writing manifest file '/private/var/folders/r1/c30g6kr946l2czzpkr2mvrd80000gn/T/pip-install-q1m4s1hh/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
<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.
I'm not an expert on how things like this work, so I included as much information as I could. I appreciate any help you can give on this.
First, django-heroku is no longer maintained, so my advice is to not use it.
Your problem, though is with psycopg2, as the error mentions, not django-heroku directly. Since django-heroku depends on psycopg2, installing psycopg2-binary probably won't help - and there can be issues with this as well, it's not suitable for serving your site from, although you're probably not doing that on OS X.
To get it working, you need to install the PostgreSQL libraries:
brew install postgresql
Depending on a few things, you may also have problems after that. If you see any errors about gcc and ssl, you can try running:
setenv LDFLAGS "-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib"
For fish, or if you running bash:
export LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib"
It can be tricky, so that may not be enough.

Difference between pip3 and `python3 setup.py install` regarding cmdclass argument

I tried to configure my package such that a script is executed on the installation process. Therefore, I inherited from setuptools.command install and created my custom class ActionOnInstall to do stuff when package is installed. This class is called via setuptools setup() argument cmdclass as described here.
A minimal example of such a setup.py file looks like
from setuptools import find_packages, setup
from setuptools.command.install import install
class ActionOnInstall(install):
def run(self):
print("Call install.run(self) works!")
install.run(self)
setup(name='name',
cmdclass={
'install': ActionOnInstall})
Building the package by executing
pip3 install <path-to-dir-with-setup.py>
runs successfully but does not execute commands specified in ActionOnInstall.run(). More directly calling this setup.py by
python3 setup.py install
executes commands specified in ActionOnInstall.run().
Then, I found myself asking: what is the actual difference of these both approaches to install a package. I know, like other posts tell us, pip makes life easier regarding package installation. But how these both approaches treat the cmdclass argument of setup() differently is not explained. Thus, I would highly appreciate to hear from you guys.
pip calls your setup.py but it redirects stdout/stderr. To test setup.py under pip write to a file in a fixed location:
class ActionOnInstall(install):
def run(self):
print("Call install.run(self) works!", file=open('/tmp/debug.log', 'w'))
install.run(self)
Look into /tmp/debug.log after pip install .
pip does run python setup.py install when installing your package - it does not change the way your setup.py feel is executed.
The reason you don't see any output is, as #phd mentioned, that pip by default hides all the output from running the setup.py file since most of the information printed when running python setup.py install is not useful to most users.
You can see this hidden output, along with everything else pip does, by passing the "--verbose" option to pip install:
$ pip install --verbose ./foo
Processing ./foo
Running setup.py (path:/private/var/folders/4d/bt0_xfx56bjfmmt2bv3r5_qh0000gn/T/pip-ti0o0gtu-build/setup.py) egg_info for package from file:///Users/pradyunsg/.venvwrap/venvs/t
mp-c0ebb35987c76ad/foo
Running command python setup.py egg_info
running egg_info
creating pip-egg-info/foo.egg-info
writing pip-egg-info/foo.egg-info/PKG-INFO
writing dependency_links to pip-egg-info/foo.egg-info/dependency_links.txt
writing top-level names to pip-egg-info/foo.egg-info/top_level.txt
writing manifest file 'pip-egg-info/foo.egg-info/SOURCES.txt'
reading manifest file 'pip-egg-info/foo.egg-info/SOURCES.txt'
writing manifest file 'pip-egg-info/foo.egg-info/SOURCES.txt'
Source in /private/var/folders/4d/bt0_xfx56bjfmmt2bv3r5_qh0000gn/T/pip-ti0o0gtu-build has version 0.0.0, which satisfies requirement foo==0.0.0 from file:///Users/pradyunsg/.ve
nvwrap/venvs/tmp-c0ebb35987c76ad/foo
Could not parse version from link: file:///Users/pradyunsg/.venvwrap/venvs/tmp-c0ebb35987c76ad/foo
Installing collected packages: foo
Running setup.py install for foo ... Running command /Users/pradyunsg/.venvwrap/venvs/tmp-c0ebb35987c76ad/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/privat
e/var/folders/4d/bt0_xfx56bjfmmt2bv3r5_qh0000gn/T/pip-ti0o0gtu-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(comp
ile(code, __file__, 'exec'))" install --record /var/folders/4d/bt0_xfx56bjfmmt2bv3r5_qh0000gn/T/pip-cetn8xa9-record/install-record.txt --single-version-externally-managed --compi
le --install-headers /Users/pradyunsg/.venvwrap/venvs/tmp-c0ebb35987c76ad/bin/../include/site/python3.6/foo
running install
Call install.run(self) works!
running build
running install_egg_info
running egg_info
creating foo.egg-info
writing foo.egg-info/PKG-INFO
writing dependency_links to foo.egg-info/dependency_links.txt
writing top-level names to foo.egg-info/top_level.txt
writing manifest file 'foo.egg-info/SOURCES.txt'
reading manifest file 'foo.egg-info/SOURCES.txt'
writing manifest file 'foo.egg-info/SOURCES.txt'
Copying foo.egg-info to /Users/pradyunsg/.venvwrap/venvs/tmp-c0ebb35987c76ad/lib/python3.6/site-packages/foo-0.0.0-py3.6.egg-info
running install_scripts
writing list of installed files to '/var/folders/4d/bt0_xfx56bjfmmt2bv3r5_qh0000gn/T/pip-cetn8xa9-record/install-record.txt'
done
Removing source in /private/var/folders/4d/bt0_xfx56bjfmmt2bv3r5_qh0000gn/T/pip-ti0o0gtu-build
Successfully installed foo-0.0.0
Cleaning up...

falied to install flask under virutalenv on windows -- [Error 2] The system cannot find the file specified

I'm using python 2.7 on a windows box.I'm able to install flask using pip install, as you can see below:
However, after I created a virtualenv, I got below error when trying to do the same thing.
scripts:
$pip install virtualenv
$cd /d d:
$mkdir test
$cd test
$virtualenv flaskEnv
$cd flaskEnv/Scritps/
$activate
$cd ../../
$pip install flask
log file as below:
Collecting flask
Using cached Flask-0.11.1-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): click>=2.0 in c:\projects\flask-react\flsk\lib\site-packages (from flask)
Requirement already satisfied (use --upgrade to upgrade): Werkzeug>=0.7 in c:\projects\flask-react\flsk\lib\site-packages (from flask)
Collecting Jinja2>=2.4 (from flask)
Using cached Jinja2-2.8-py2.py3-none-any.whl
Collecting itsdangerous>=0.21 (from flask)
Collecting MarkupSafe (from Jinja2>=2.4->flask)
Using cached MarkupSafe-0.23.tar.gz
Building wheels for collected packages: MarkupSafe
Running setup.py bdist_wheel for MarkupSafe: started
Running setup.py bdist_wheel for MarkupSafe: finished with status 'error'
Complete output from command c:\projects\flask-react\flsk\scripts\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\admini~1\\appdata\\local\\temp\\pip-build-3ep417\\MarkupSafe\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d c:\users\admini~1\appdata\local\temp\tmp8mkr70pip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win32-2.7
creating build\lib.win32-2.7\markupsafe
copying markupsafe\tests.py -> build\lib.win32-2.7\markupsafe
copying markupsafe\_compat.py -> build\lib.win32-2.7\markupsafe
copying markupsafe\_constants.py -> build\lib.win32-2.7\markupsafe
copying markupsafe\_native.py -> build\lib.win32-2.7\markupsafe
copying markupsafe\__init__.py -> build\lib.win32-2.7\markupsafe
running egg_info
writing MarkupSafe.egg-info\PKG-INFO
writing top-level names to MarkupSafe.egg-info\top_level.txt
writing dependency_links to MarkupSafe.egg-info\dependency_links.txt
warning: manifest_maker: standard file '-c' not found
reading manifest file 'MarkupSafe.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'MarkupSafe.egg-info\SOURCES.txt'
copying markupsafe\_speedups.c -> build\lib.win32-2.7\markupsafe
running build_ext
building 'markupsafe._speedups' extension
error: [Error 2] The system cannot find the file specified
----------------------------------------
Running setup.py clean for MarkupSafe
Failed to build MarkupSafe
Installing collected packages: MarkupSafe, Jinja2, itsdangerous, flask
Running setup.py install for MarkupSafe: started
Running setup.py install for MarkupSafe: finished with status 'error'
Complete output from command c:\projects\flask-react\flsk\scripts\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\admini~1\\appdata\\local\\temp\\pip-build-3ep417\\MarkupSafe\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\admini~1\appdata\local\temp\pip-8v3_ep-record\install-record.txt --single-version-externally-managed --compile --install-headers c:\projects\flask-react\flsk\include\site\python2.7\MarkupSafe:
running install
running build
running build_py
creating build
creating build\lib.win32-2.7
creating build\lib.win32-2.7\markupsafe
copying markupsafe\tests.py -> build\lib.win32-2.7\markupsafe
copying markupsafe\_compat.py -> build\lib.win32-2.7\markupsafe
copying markupsafe\_constants.py -> build\lib.win32-2.7\markupsafe
copying markupsafe\_native.py -> build\lib.win32-2.7\markupsafe
copying markupsafe\__init__.py -> build\lib.win32-2.7\markupsafe
running egg_info
writing MarkupSafe.egg-info\PKG-INFO
writing top-level names to MarkupSafe.egg-info\top_level.txt
writing dependency_links to MarkupSafe.egg-info\dependency_links.txt
warning: manifest_maker: standard file '-c' not found
reading manifest file 'MarkupSafe.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'MarkupSafe.egg-info\SOURCES.txt'
copying markupsafe\_speedups.c -> build\lib.win32-2.7\markupsafe
running build_ext
building 'markupsafe._speedups' extension
error: [Error 2] The system cannot find the file specified
Does the error message mean something to anyone?
thanks
This issue seems to be related with the setuptools version installed in your virtualenv. Downgrading to an older version fixed it for me.
From your virtualenv:
pip install setuptools==21.2.1
pip install flask
I had this problem yesterday. I resolved it by downloading the MarkupSafe wheel and installing with pip. The problem was way over my head. Something about compiler flags in order to suppress an error when generating the Speedups file, I think.
1) Download the wheel from the link above.
2) On Windows, open a command window in the same directory as the wheel.
3) run "pip Install "
The setup.py of MarkupSafe is broken for Win7 on my system where there is no C compiler. (I keep a separate VM for VC++ work) I did this to get it working:
pip download MarkupSafe
mkdir temp
open MarkupSafe-0.23.tar.gz with 7-zip, extract all to temp
cd temp
edit setup.py line 119 to read: if 0: #not (is_pypy or is_jython):
python setup.py install
I did not try to debug setup.py to work correctly. I just wanted to try out Flask since it's supposed to be lightweight and easy to learn, and the official docs say it installs on Windows. Maybe I should go back to Perl...
Unlike the other poster, a global pip install of MarkupSafe didn't work for me either.
These links have other views/insights on the problem:
https://github.com/pallets/markupsafe/issues/26
https://github.com/babun/babun/issues/315
ok. I figure it out. I don't think there is anything wrong in the way I install flask, as I already mentioned in my question, I am able to install it globally (without running within a virtualenv).
the MarkupSafe package has an extension which is implement using c, and I don't have windows sdk installed on my local machine, so when ve_build_ext runs,
**** it always fail **
the difference is if not (is_pypy or is_jython) , it gives a warning, which is what i got when installing it globally; it crashes, though, when running under a virtualenv. So I'm pretty sure that hasattr(sys, 'pypy_version_info') return true when running under a virtualenv.
Does anybody have an idea what "hasattr(sys, 'pypy_version_info')" mean??
# fail safe compilation shamelessly stolen from the simplejson
# setup.py file. Original author: Bob Ippolito
is_jython = 'java' in sys.platform
is_pypy = hasattr(sys, 'pypy_version_info')
def run_setup(with_binary):
ext = Extension('markupsafe._speedups', ['markupsafe/_speedups.c'])
ext_modules = [ext] if with_binary else []
def try_building_extension():
try:
run_setup(True)
except BuildFailed:
LINE = '=' * 74
BUILD_EXT_WARNING = 'WARNING: The C extension could not be ' \
'compiled, speedups are not enabled.'
echo(LINE)
echo(BUILD_EXT_WARNING)
echo('Failure information, if any, is above.')
echo('Retrying the build without the C extension now.')
echo()
run_setup(False)
echo(LINE)
echo(BUILD_EXT_WARNING)
echo('Plain-Python installation succeeded.')
echo(LINE)
if not (is_pypy or is_jython):
try_building_extension()
else:
run_setup(False)
I had this issue today and was able to resolve it by manually installing MarkupSafe from a wheel file, per Lincoln's suggestion above. You can download the appropriate file here. There were several available. I don't know what the difference between all of them is, but the only one that would even install on Windows 10 was the one called MarkupSafe-0.23-cp27-none-win32.whl. After downloading it, I copied it into the directory I created using virtualenv (not sure if that's necessary but that's what I did) and installed it with pip:
C:\flask-test\venv>pip install MarkupSafe-0.23-cp27-none-win32.whl
from that directory. After that I went back to the main directory and installed Flask
C:\flask-test\venv>cd ..
C:\flask-test>pip install Flask
and it worked fine.

Problems installing cryptography

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

pip install scipy, failed with error code -11

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

Categories

Resources