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...
Related
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.
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.
In the terminal I run this command:
Python pnot.py
I get the following error:
Traceback (most recent call last):
File "pnot.py", line 1, in <module>
from APNSWrapper import *
ImportError: No module named APNSWrapper
I have tried to install the module:
pip install APNSWrapper==0.6.1
Requirement already satisfied (use --upgrade to upgrade): APNSWrapper==0.6.1 in /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages
Requirement already satisfied (use --upgrade to upgrade): docutils>=0.3 in /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages (from APNSWrapper==0.6.1)
Cleaning up...
I have tried to install APNS:
Pip install apns
I get the following error:
Downloading/unpacking apns
Downloading apns-1.1.2.tar.gz
Running setup.py egg_info for package apns
Installing collected packages: apns
Running setup.py install for apns
error: /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/__pycache__/apns.cpython-33.pyc: Permission denied
Complete output from command /Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3 -c "import setuptools;__file__='/private/var/folders/8g/6w73vzqs04b6f1cq8m8pyswc0000gn/T/pip_build_samiesyed/apns/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/8g/6w73vzqs04b6f1cq8m8pyswc0000gn/T/pip-3yfn_n-record/install-record.txt --single-version-externally-managed:
running install
running build
running build_py
creating build
creating build/lib
copying apns.py -> build/lib
running install_lib
copying build/lib/apns.py -> /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages
byte-compiling /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/apns.py to apns.cpython-33.pyc
error: /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/__pycache__/apns.cpython-33.pyc: Permission denied
----------------------------------------
Cleaning up...
Command /Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3 -c "import setuptools;__file__='/private/var/folders/8g/6w73vzqs04b6f1cq8m8pyswc0000gn/T/pip_build_samiesyed/apns/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/8g/6w73vzqs04b6f1cq8m8pyswc0000gn/T/pip-3yfn_n-record/install-record.txt --single-version-externally-managed failed with error code 1 in /private/var/folders/8g/6w73vzqs04b6f1cq8m8pyswc0000gn/T/pip_build_s/apns
Storing complete log in /Users/s/.pip/pip.log
script code:
from APNSWrapper import *
wrapper = APNSNotificationWrapper('cert.pem', True)
for token in ['xxxxxxx']:
token = binascii.unhexlify(token)
apn = APNSNotification()
apn.token(token)
alert = APNSAlert()
alert.body('hello world')
apn.alert(alert)
apn.sound()
wrapper.append(apn)
wrapper.notify()
This is really frustrating me, not sure why the script is not executing.
Most likely pip and python point to different Python installations. One might be from package manager, one might be from the system defaults.
You can find this out by doing commands
which python
which pip
Probably pip installs packages against some other python installation you are trying to use.
The solution to the problem, no matter how it has manifested itself, is to use virtualenv environments for your Python package installations. virtualenv creates a self-contained folder containing the python interpreter and package installations, which you can wipe clean and rebuild in the case of problems.
First install virtualenv.
Then do:
virtualenv venv # Create virtualenv installation in folder called venv
source venv/bin/activate # Modify your shell and PATH to use python from venv/bin/python
pip install apns # Installs apns in venv/lib
python pnot.py # Now it runs your script using venv/bin/python interpreter
# and packages installed in venv/lib/python2.7
More information about python and virtualenv installations
http://opensourcehacker.com/2012/09/16/recommended-way-for-sudo-free-installation-of-python-software-with-virtualenv/
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.
I run pip install Scrapy and everything seems to download fine, but installation ultimately fails.
Is there some sort of an issue with permissions? I'm a novice, so any help much appreciated!
Abridged terminal output:
...
running install_egg_info
running egg_info
writing requirements to Scrapy.egg-info/requires.txt
writing Scrapy.egg-info/PKG-INFO
writing top-level names to Scrapy.egg-info/top_level.txt
writing dependency_links to Scrapy.egg-info/dependency_links.txt
warning: manifest_maker: standard file '-c' not found
reading manifest file 'Scrapy.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'docs/build'
writing manifest file 'Scrapy.egg-info/SOURCES.txt'
Copying Scrapy.egg-info to /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Scrapy-0.16.3-py2.7.egg-info
running install_scripts
copying build/scripts-2.7/scrapy -> /Library/Frameworks/Python.framework/Versions/2.7/bin
error: /Library/Frameworks/Python.framework/Versions/2.7/bin/scrapy: Permission denied
----------------------------------------
Command /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c "import setuptools;__file__='/Users/pavelfage/build/Scrapy/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /var/folders/x6/wf5kq24j109dnkhgjcs822ym0000gn/T/pip-QgV9nv-record/install-record.txt failed with error code 1
To write in /Library/Frameworks/* use sudo pip install scrapy
If doing using virtual environment, first activate the environment and then install
$ . /path/to/venv/bin/activate
$ pip install scrapy