I'm running python 2.7 on Windows 7 x64, and trying to easy_install pysqlite.
With command: easy_install -U pysqlite
It exits with the error:
error: Setup script exited with error: Unable to find vcvarsall.bat
This site: http://code.google.com/p/rdflib/issues/detail?id=104#c4
suggests a workaround of installing MingGW, saying to check the g++ option on install (plus some other stuff).
Unfortunately, MingGW does not give me the option to install g++, only c++, and of course on running easy_install a second time, I get ".. command 'gcc' failed: No such file or directory". So now I am el stucko.
Any advice on how to fix this problem would be great!
Even if you install a compiler (MinGW or Visual Studio), you still have to install SQLite3 development libraries. It is a pain to build things on Windows, so I suggest that you get the unofficial pre-built Windows binaries and install it.
As an aside, you should probably consider switching to ActivePython as it includes a package manager that allows you to install pre-built modules from ActiveState's repository.
As for the particular error in question, that is a distutils bug and you should raise your concerns in the Python bug tracker.
When that says "g++ compiler" they really mean the C++ compiler, which for mingw is gcc.
You need to install the Microsoft Visual C compiler thingy (the 2010 one). And use that as your compiler for all modules. You can also mess with distuls.cfg and specify a compiler that way.
Related
I have the dependencies installed (openssl, lxml, pyopenssl, twisted matrix, etc...) and when I type in the command
easy_install Scrapy
it seems to work, and gives me this output
Searching for scrapy
Best match: scrapy 0.24.2
Processing scrapy-0.24.2-py2.7.egg
scrapy 0.24.2 is already the active version in easy-install.pth
Installing scrapy script to C:\Users\Joel\AppData\Local\Enthought\Canopy\User\Sc
ripts
Installing scrapy.bat script to C:\Users\Joel\AppData\Local\Enthought\Canopy\Use
r\Scripts
Using c:\users\joel\appdata\local\enthought\canopy\user\lib\site-packages\scrapy
-0.24.2-py2.7.egg
Processing dependencies for scrapy
Finished processing dependencies for scrapy
however, when I check the version of scrapy it gives me this error
C:\python27\python.exe: No module named scrapy
how do I install scrapy? I would like to scrape the web...
EDIT: when using
pip install scrapy
i get this error
************************************************************************
WARNING:
An optional code optimization (C extension) could not be compiled.
Optimizations for this package will not be available!
()
Could not find Visual Studio 2008 in your path.
If you do not have Visual Studio 2008 installed, you can use
the MinGW compiler instead. To install mingw, do:
enpkg mingw
To use the MinGW compiler to build an extension module, use
the '-c' flag, e.g.:
python setup.py build_ext -c mingw64
Note that building Python extensions with MinGW is not officially
supported, although it is known to work in many cases.
****************************************************************************
I have installed visual studio 2008 so maybe my path isnt pointing there? if so what do I need to add as an environmental variable so it sees it?
It seems possible, since you appear to have loaded the Enthought distribution, that the easy_install you ran used a different Python from the one you get when you use the "python" command (i.e one runs the Enthought distribution, one runs your system-installed Python, which eceryone except Alex gaynor should leave strictly alone). You should be able to check this with which easy_install and which python commands.
If they do appear to be related to the same Python executable I am a little at a loss.
Are you sure you have all of the correct dependencies?
Environment variables
OpenSSL
Visual C++
Check this link and let us know how you are checking the version and what errors you are getting.
http://doc.scrapy.org/en/latest/intro/install.html#intro-install-platform-notes
It looks like you are installing to the correct version of Python, but you can always try
easy_install-2.7 scrapy
I have pyenv, and i want to use python 3.4.1 against apache.
To that end, I have installed mod_wsgi 4.2.7
In compiling mod_wsgi, I get the following error:
Object_NextNotImplemented' can not be used when making a shared object; recompile with -fPIC
/root/.pyenv/versions/3.4.1/lib/libpython3.4m.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
.
make: *** [src/server/mod_wsgi.la] Error 1
According to this page the issue is something to do with a 64bit or a 32 bit or... I don't know.
Anyway, the solution is to re-compile python with some sort of flag.
How do i resolve this issue, bearing in mind that i am using pyenv?
This is not the solution, i still get the same error after having done this
PYTHON_CONFIGURE_OPTS="--enable-unicode=ucs4 --enable-shared"
pyenv uninstall 3.4.1
pyenv install 3.4.1
so the first line - i didn't think would actually work, I don't know what it is doing. I guess it is just setting some magic system variable somewhere? Oh well, it is doing that.
I don't know what the unicode bit does - this was all suggested in this link here.
Becuase i am wanting to use python 3.4.1, and because it already exists, i then uninstall python 3.4.1
Then i reinstall python 3.4.1
If you wanted to do the same with python x.y.z, you would similarly have
PYTHON_CONFIGURE_OPTS="--enable-unicode=ucs4 --enable-shared"
pyenv uninstall x.y.z
pyenv install x.y.z
If you had not installed x.y.z python earlier, um, then you wouldn't need to uninstall it.
This whole installation process takes... a while. I started writing this answer right after i kicked off the install command, and it only recently finished.
On finishing i get
WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
Installed Python-3.4.1 to /root/.pyenv/versions/3.4.1
But i don't know if that is bad or good. The prompt itself doesn't seem to know either, what with all those question marks around.
Below is the error I get when I do a sudo pip install imposm
#include "tcutil.h"
^
1 error generated.
error: command 'gcc' failed with exit status 1
I believe that I already have gcc (version: 4.2.1) installed under /usr/bin/gcc on my Mac (OSX 10.8.5). I don't know what else needs to be done. Other details.
gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
Edit: I already have the listed requirements (C/C++ compiler, the Python libraries and Google Protobuf) on my Mac. This is why the error baffles me.
You need to install tokyo-cabinet, which imposm uses for caching.
If you use homebrew, it's simply: brew install tokyo-cabinet
The documentation for that module states the following:
The PBF parser is written as a C extension and you need to have a
C/C++ compiler, the Python libraries and Google Protobuf.
At least, if this is the appropriate documentation for that module (http://imposm.org/docs/imposm.parser/latest/install.html#installation)
I can't really research how to install these components on a mac, but if you haven't fulfilled those requirements, that may be the reason why it's not working.
Using pip install zipline on Windows 8 with Python 2.7 gives me the error:
Downloading/unpacking six (from python-dateutil==2.1->delorean->zipline[all])
Running setup.py egg_info for package six
Installing collected packages: blist, pytz, requests, python-dateutil, six
Running setup.py install for blist
building '_blist' extension
error: Unable to find vcvarsall.bat
Complete output from command C:\Python27\python.exe -c "import setuptools;__
file__='c:\\users\\ThatsMe\\appdata\\local\\temp\\pip-build-ThatsMe\\blist\\setup.py';ex
ec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" inst
all --record c:\users\ThatsMe\appdata\local\temp\pip-xvoky2-record\install-record.tx
t --single-version-externally-managed:
running install
running build
running build_py
running build_ext
building '_blist' extension
error: Unable to find vcvarsall.bat
Question: How can the error be resolved? Running pip install zipline[all] gives the same error...
The problem here is the line 292 (Using Python 3.4.3 here) in $python_install_prefix/Lib/distutils/msvc9compiler.py which says:
VERSION = get_build_version()
This only checks for the MSVC version that your python was built with. Just replacing this line with your actual Visual Studio version, eg. 12.0 for MSVC2013
VERSION = 12.0
will fix the issue.
UPDATE: Turns out that there is a good reason why this version is hardcoded. MSVC C runtime is not required to be compatible between major versions. Hence when you use a different VS version you might run into runtime problems. So I advise to use VS 2008 (for Python 2.6 up to 3.2) and VS2010 for (Python 3.3 and later) until this issue is sorted out.
Binary compatibility will arrive with VS 2015 (see here) along with Python 3.5 .
For Python 2.7 users Microsoft released a special Microsoft Visual C++ Compiler for Python 2.7 which can be used without installing the whole VS 2008.
You could use ol' good easy_install zipline instead.
easy_install isn't pip but one good aspect of it is the ability to download and install binary packages too, which would free you for the need having VC++ ready. This of course relies of the assumption that the binaries were prepared for your Python version.
UPDATE:
Yes, Pip can install binaries now!
There's a new binary Python archive format (wheel) that is supposed to replace "eggs". Wheels are already supported by pip. This means you'll be able to install zipline with pip without compiling it as soon as someone builds the wheel for your platform and uploads it to PyPI.
If you are getting this error on Python 2.7 you can now get the Microsoft Visual C++ Compiler for Python 2.7 as a stand alone download.
If you are on 3.3 or later you need to install Visual Studio 2010 express which is available for free here: https://www.visualstudio.com/downloads/download-visual-studio-vs#d-2010-express
If you are 3.3 or later and using a 64 bit version of python you need to install the Microsoft SDK 7.1 that ships a 64 bit compiler and follow the directions here Python PIP has issues with path for MS Visual Studio 2010 Express for 64-bit install on Windows 7
First, you should look for the file vcvarsall.bat in your system.
If it does not exist, I recommend you to install Microsoft Visual C++ Compiler for Python 2.7. This will create the vcvarsall.bat in "C:\Program Files (x86)\Common Files\Microsoft\Visual C++ for Python\9.0" if you install it for all users.
The problem now is in the function find_vcvarsall(version) in the C:/Python27/Lib/distutils/msvc9compiler.py module, which is looking for the vcvarsall.bat file.
Following the function calls you will see it is looking for an entry in the registry containing the path to the vcvarsall.bat file. It will never find it because this function is looking in other directories different from where the above-mentioned installation placed it, and in my case, the registry didn't exist.
The easiest way to solve this problem is to manually return the path of the vcvarsall.bat file. To do so, modify the function find_vcvarsall(version) in the msvc9compiler.py file with the absolute path to the vcvarsall.bat file like this:
def find_vcvarsall(version):
return r"C:\Program Files (x86)\Common Files\Microsoft\Visual C++ for Python\9.0\vcvarsall.bat"
This solution worked for me.
If you already have the vcvarsall.bat file you should check if you have the key productdir in the registry:
(HKEY_USERS, HKEY_CURRENT_USERS, HKEY_LOCAL_MACHINE or HKEY_CLASSES_ROOT)\Software\Wow6432Node\Microsoft\VisualStudio\version\Setup\VC
Where version = msvc9compiler.get_build_version()
If you don't have the key just do:
def find_vcvarsall(version):
return <path>\vcvarsall.bat
To understand the exact behavior check msvc9compiler.py module starting in the find_vcvarsall(version) function.
Simply because you don't have c++ compiler installed there in your machine, check the following
Download Microsoft Visual C++ 2008 from this page. That is a generally useful page anyway, so you should probably bookmark it. For Python 3.3+ use MS Visual C++ 2010.
Install it.
Open Windows explorer (the file browser) and search for the location of ‘vcvarsall.bat’ and cut it to your clipboard.
run regedit from the Windows start key. You will need admin privilges.
Add a registry entry to
HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\VisualStudio\9.0\Setup\VC\ProductDir (64 bit Windows) or
HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\9.0\Setup\VC\ProductDir (32 bit)
as described here.
Hint: 0.9 in the registery directory is the currently installed version of your visual studio, if you running VS 2013, you have to find the path HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\VisualStudio\12.0....
At the Windows start key, type cmd to get a command shell. If you need to, go to your virtual environment and run activate.bat.
pip install or whatever you use to install it.
You need to have Visual Studio's bin dir in your path. Pip install is trying to compile some C code.
I spent hours researching this vcvarsall.bat as well. Most answers on SO focus on Python 2.7 and / or creating workarounds by modifying system paths. None worked for me. This solution worked out of the box for Python 3.5 and (I think) is the "correct" way of doing it.
See this link -- it describes the Windows Compilers to use for different versions of Python: https://wiki.python.org/moin/WindowsCompilers#Microsoft_Visual_C.2B-.2B-_14.0_standalone:_Visual_C.2B-.2B-_Build_Tools_2015_.28x86.2C_x64.2C_ARM.29
For Python 3.5, download this: https://www.microsoft.com/en-us/download/details.aspx?id=49983
For me, I had to run C:\Program Files (x86)\Microsoft Visual C++ Build Tools\Visual C++ x64 Native Build Tools Command Prompt for it to work. From that command prompt, I ran "pip install django_compressor" which was the particular package that was causing me an issue, and it worked perfectly.
Hope this saves someone some time!
Thanks to "msoliman" for his hint, however his answer doesn't give clear solution for those who doesn't have VS2010
For example I have VS2012 and VS2013 and there are no such KEYs in system registry.
Solution:
Edit file: "[Python_install_loc]/Lib/distutils/msvc9compiler.py"
Change on line 224:
productdir = Reg.get_value(r"%s\Setup\VC" % vsbase,
"productdir")
to:
productdir = "C:\Program Files (x86)\Microsoft Visual Studio [your_vs_version(11/12...)]\VC"
and that should work
If you are trying to install matplotlib in order to work with graphs on python. Try this link.
https://github.com/jbmohler/matplotlib-winbuild.
This is a set of scripts to build matplotlib from source on the MS Windows platform.
To build & install matplotlib in your Python, do:
git clone https://github.com/matplotlib/matplotlib
git clone https://github.com/jbmohler/matplotlib-winbuild
$ python matplotlib-winbuild\buildall.py
The build script will auto-detect Python version & 32/64 bit automatically.
I appreciate this might not be the answer to resolving on 3.4 but I tried a huge variety of things to fix this on 3.4 and thought this might be useful if someone is time pressed or doesn't have the know-how to correct it (in my case, work demands).
With exactly the same setup, I found that my installation problems only happened with Python 3.4. When I changed to 2.7, all my issues seemed to be resolved.
We have a rather overzealous security setup though so I'm going to try the same on my home version (still 3.4) and see if I have any more joy. My inclination is that my VS version has somehow been restricted and the answers above should help. If I find anything more tonight I'll add further detail.
This is my first reply, not the most technical I'm afraid!
I am trying to install the python readline module. I have already installed readline via homebrew.
If I type
easy_install readline
I get
Downloading http://pypi.python.org/packages/source/r/readline/readline-6.2.2.tar.gz#md5=ad9d4a5a3af37d31daf36ea917b08c77
Processing readline-6.2.2.tar.gz
Writing /var/folders/44/dhrdb5sx53s243j4w03063vh0000gn/T/easy_install-64FbG8/readline-6.2.2/setup.cfg
Running readline-6.2.2/setup.py -q bdist_egg --dist-dir /var/folders/44/dhrdb5sx53s243j4w03063vh0000gn/T/easy_install-64FbG8/readline-6.2.2/egg-dist-tmp-NOmStB
clang: error: no such file or directory: 'readline/libreadline.a'
clang: error: no such file or directory: 'readline/libhistory.a'
error: Setup script exited with error: command '/usr/bin/clang' failed with exit status 1
Any ideas about how I could fix this ?
Thanks
There is a new solution to this problem in Pypi, pip install gnureadline.
https://pypi.python.org/pypi/gnureadline
The root issue is libedit (BSD-licensed) vs. Gnu Readline (GPL-licensed) . Apple would rather provide incompatible BSD code, than provide compatible code that has GPL restrictions.
This bug should be fixed in readline version 6.2.4 released last week.
Also note that you do not need to install the readline library itself via homebrew. It is already included within the python readline module.
Anyone having problems with the python-readline module is welcome to open an issue on the GitHub page of the module. This will ensure that the problem is permanently solved for everyone.
I had this same problem in OS X Lion 10.8, and fixed it by renaming my /Developer to /Developer-old. See this issue.
None of the above worked from me.
After uninstall ipython and readline, I ran the following that finally worked
easy_install http://pypi.python.org/packages/source/r/readline/readline-6.1.0.tar.gz
pip install ipython
And yes, readline 6.1.0 is an old one, but 6.2.x or other would not work (in sept 2013).
Try installing the binary egg directly:
$ easy_install http://pypi.python.org/packages/2.7/r/readline/readline-6.2.2-py2.7-macosx-10.7-intel.egg#md5=25383d860632d4a1521961ba68a52fe2
Make sure you have gcc installed.
which gcc
should return
/usr/bin/gcc
I was getting the same error when trying to easy_install readline. It wasn't until I downloaded the tar and tried to manually build it that I noticed it said
checking whether make sets $(MAKE)... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/Users/roneill/readline-6.2.4.1/rl/readline-lib':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
that I realized what the actual problem was. I had not used this particular laptop in a while and had not used Xcode to install the command line tools. Once I did, things worked properly.