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
Related
I set the virtualenv for my project and when I want to run
pip install psycopg2
I get an error below
ERROR: Complete output from command python setup.py egg_info:
ERROR: running egg_info
creating pip-egg-info/psycopg2.egg-info
writing pip-egg-info/psycopg2.egg-info/PKG-INFO
writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
Error: pg_config executable not found.
pg_config is required to build psycopg2 from the source. Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
If you prefer to avoid building psycopg2 from source, please install the PyPI
'psycopg2-binary' package instead.
For further information please check the 'doc/src/install.rst' file (also at
<http://initd.org/psycopg/docs/install.html>).
ERROR: Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/r5/mt37g42j2h3b676lpx3qlznm0000gn/T/pip-install-yijundiy/psycopg2/
after that, I run brew install postgresql and then when I wanted to run :
pip install psycopg2 I got this error:
Running setup.py install for psycopg2 ... error
Running setup.py install for psycopg2 ... error
ERROR: Complete output from command
ERROR: Command "/Users/masoudmk/Desktop/Masoud/projectenv/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/private/tmp/pip-install-6qi9xbe0/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/tmp/pip-record-t8hmiffn/install-record.txt --single-version-externally-managed --compile --install-headers /Users/masoudmk/Desktop/Masoud/projectenv/bin/../include/site/python3.7/psycopg2" failed with error code 1 in /private/tmp/pip-install-6qi9xbe0/psycopg2/
In addition, when I use this command
sudo python setup.py install
I get this error too:
(null): can't open file 'setup.py': [Errno 2] No such file or directory
What should I do!?
get a stand-alone package
run pip install psycopg2-binary
I think you don't have Postgres installed, you can install by using
brew install postgresql
that helps your problem. after that, you can install pip dependency packages
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...
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.
building 'PIL._imaging' extension
error: [WinError 2] The system cannot find the file specified
----------------------------------------
Failed building wheel for Pillow
Failed to build Pillow
Installing collected packages: Pillow
Running setup.py install for Pillow
Complete output from command c:\users\anilkumar.vandrangi\desktop\aspire\python.exe -c "import setuptools, tokenize;__file__='C:\\Users\\ANILKU~1.VAN\\AppData\\Local\\Temp\\pip-build-tr4denzb\\Pil
low\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\ANILKU~1.VAN\AppData\Local\Temp\pip-7zffvlgz-record\in
stall-record.txt --single-version-externally-managed --compile:
Single threaded build, not installing mp_compile: 4 processes
running install
running build
running build_py
running egg_info
writing top-level names to Pillow.egg-info\top_level.txt
writing Pillow.egg-info\PKG-INFO
writing dependency_links to Pillow.egg-info\dependency_links.txt
warning: manifest_maker: standard file '-c' not found
reading manifest file 'Pillow.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'Pillow.egg-info\SOURCES.txt'
running build_ext
building 'PIL._imaging' extension
error: [WinError 2] The system cannot find the file specified
----------------------------------------
Command "c:\users\anilkumar.vandrangi\desktop\aspire\python.exe -c "import setuptools, tokenize;__file__='C:\\Users\\ANILKU~1.VAN\\AppData\\Local\\Temp\\pip-build-tr4denzb\\Pillow\\setup.py';exec(comp
ile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\ANILKU~1.VAN\AppData\Local\Temp\pip-7zffvlgz-record\install-record.txt --singl
e-version-externally-managed --compile" failed with error code 1 in C:\Users\ANILKU~1.VAN\AppData\Local\Temp\pip-build-tr4denzb\Pillow
I'm assuming that you have are on x64 bit Windows.
The cleanes way to solve it:
If you have installed 32 bit version of python: uninstall it
install 64 bit
During setup choose to add python to path
Download 64 bit version of pillow:
http://wp.stolaf.edu/it/installing-pil-pillow-cimage-on-windows-and-mac/
Run the setup file.
Check your Pip version to see if you have the last version available.
C:\ python3 -m pip install --version
You can either use python or python3, I used python3 because I have 2.7 and 3.5 on the same disk.
If your version is not the latest update with:
C:\ python3 -m pip install --upgrade pip
Then now try pip install Pillow again:
C:\ python3 -m pip install Pillow
This time it has to work without problems.
You're getting this error because the pillow version you're trying to install is incompatible with your python version.
Try upgrading both as a final resort.
I am trying to setup a Python development environment in Visual Studio 2013 using the new PTVS. However, I need to be able to develop in both Python 2.7 and Python 3.3. Here's what I have done so far for both versions:
Installed distribute
Installed pip
Added C:\Python 3.3\Scripts & C:\Python 2.7\Scripts to my Path environment variable.
So in the Scripts folders I have:
easy_install.exe
easy_install-3.3.exe
pip.exe
pip-3.3.exe
easy_install.exe
easy_install-2.7.exe
pip.exe
pip-2.7.exe
Along with the executables are the corresponding python scripts.
Now having done this, I am trying to install a Python module RPi.GPIO, but I am getting the following error message:
C:\Windows\system32>pip-2.7 install RPi.GPIO==0.5.3a
Downloading/unpacking RPi.GPIO==0.5.3a
Downloading RPi.GPIO-0.5.3a.tar.gz
Running setup.py egg_info for package RPi.GPIO
Installing collected packages: RPi.GPIO
Running setup.py install for RPi.GPIO
building 'RPi.GPIO' extension
error: Unable to find vcvarsall.bat
Complete output from command "C:\Program Files\Python 2.7\python.exe" -c "import set
uptools;__file__='c:\\users\\jon\\appdata\\local\\temp\\pip_build_Jon\\RPi.GPIO\\setup.p
y';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install
--record c:\users\jon\appdata\local\temp\pip-svl0a1-record\install-record.txt --single-
version-externally-managed:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-2.7
creating build\lib.win-amd64-2.7\RPi
copying RPi\__init__.py -> build\lib.win-amd64-2.7\RPi
running build_ext
building 'RPi.GPIO' extension
error: Unable to find vcvarsall.bat
----------------------------------------
Cleaning up...
Command "C:\Program Files\Python 2.7\python.exe" -c "import setuptools;__file__='c:\\use
rs\\jon\\appdata\\local\\temp\\pip_build_Jon\\RPi.GPIO\\setup.py';exec(compile(open(__fi
le__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\jon\ap
pdata\local\temp\pip-svl0a1-record\install-record.txt --single-version-externally-manage
d failed with error code 1 in c:\users\jon\appdata\local\temp\pip_build_Jon\RPi.GPIO
Storing complete log in C:\Users\Jon\pip\pip.log
C:\Windows\system32>
It's trying real hard, but it is failing somewhere, and I can't trace it back to the source. Likewise, I always get the error: Unable to find vcvarsall.bat know matter what module I try to install. What would cause this?
I have tried removed one of the interpreters path from the environment variables, because I thought that the duplicate easy_install.exe instances might be conflicting. Making this change didn't help.
Should the install be nearly as simple as:
pip-2.7 install RPi.GPIO==0.5.3a
or
pip-3.3 install RPi.GPIO==0.5.3a
UPDATE: I just tried install RPi.GPIO by using the command:
pip-3.3 install RPi.GPIO
and it was successfully installed, but the version is way out of date. Hm..?