Error installing PyMVPA2 - python

I'm getting the following error when I try to install using pip install for PyMVPA2 for Python. I have installed other libraries without any problems before. I would appreciate if anything could take a look at the errors:
C:\Users\usr>pip install pymvpa2
Collecting pymvpa2
Using cached pymvpa2-2.4.2.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
running build_src
build_src
building extension "mvpa2.clfs.libsmlrc.smlrc" sources
building extension "mvpa2.clfs.libsvmc._svmc" sources
creating build
creating build\src.win32-2.7
creating build\src.win32-2.7\mvpa2
creating build\src.win32-2.7\mvpa2\clfs
creating build\src.win32-2.7\mvpa2\clfs\libsvmc
swig.exe++: mvpa2\clfs\libsvmc\svmc.i
swig.exe -python -I3rd\libsvm -c++ -I3rd\libsvm -o build\src.win32- 2.7\mvpa2\clfs\libsvmc\svmc_wrap.cpp -outdir build\src.win32-2.7\mvpa2\clfs\libsvmc mvpa2\clfs\libsvmc\svmc.i
error: command 'swig.exe' failed: No such file or directory
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\usr\appdata\local\temp\pip-build-v_zzkd\pymvpa2\

As the error states you either don't have swig installed or it is not on your path. You are obviously on Windows so you need to download the swig executable from the swig website - download the latest windows package and either unzip it to a directory on your existing path or to a new directory and add it to your path. Easiest, of course, is to unzip it to a new directory and then run your pip command in that directory.
What is swig anyway? Swig parses the interface definitions of code written in C/C++ and can output 'glue code' to allow code written in Python & a pile, currently 22, of other programming or scripting languages to use the C/C++ code transparently. Swig is free, open source and compatible with both open source and commercial use.
Should I keep it to hand? In most cases that I know of in python swig is only invoked during the installation or setup phase but since that setup phase will be used every time that any package built with swig is installed or upgraded there is no reason to get rid of it and quite a lot of reasons to have it somewhere on your path.

sudo apt-get remove swig
sudo apt-get install swig3.0
sudo ln -s /usr/bin/swig3.0 /usr/bin/swig
and then
pip install pymvpa2

Related

Installing python extension module : understanding skbuild+setuptools

I am one of the devs of a (fairly large) C++ simulation tool. Disclaimer : I'm more of a physicist than a dev. I wrote Python bindings for that project using pybind11.
I managed to get the Python module to compile with cmake. I then managed to write a setup.py file using skbuild that does compile the Python module :
python3 setup.py sdist bdist_wheel
In _skbuild/linux-x86_64-3.9/cmake-build/lib/ (and in the tar archive dist/cytosim-0.0.0.tar.gz) there is indeed a compiled library : cytosim.cpython-39-x86_64-linux-gnu.so.
However, when I want to install the module :
pip3 install dist
I get an error :
gcc: error: src/py3/dist.c: No such file or directory
I am very confused because I do not have an directory called py3 in src.
Any pointer ? Anything I'm doing wrong ? Thanks !
The command
pip3 install dist
tries (and fails) to install the dist package from the pypi repository.
Maybe try
pip3 install dist/cytosim-0.0.0.tar.gz
instead.

Pip install results in this error " cl.exe' failed with exit code 2 "

I've read all of the other questions on this error and frustratingly enough, none give a solution that works.
If I run pip install sentencepiece in the cmd line, it gives me the following output.
src/sentencepiece/sentencepiece_wrap.cxx(2809): fatal error C1083: Cannot open include file: 'sentencepiece_processor.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
[end of output]
I'm running python 3.10.1 and pip 22.0.3 .
*I have the following Microsoft Visual C++ programs on my windows machine,which I've just done a fresh install of as it was complaining of not having a particular C++ program.
MS VC++
I've even added the .exe file to my PATH variables but still I get the same error.
Am I missing a particular Microsoft program on my pc?
I haven't seen this problem in Windows, but for Linux, I would normally reinstall Python after installing the dependencies (such as the MSVC thing). In that case this is especially helpful because I'm often rebuilding (compiling and other related steps) Python/Pip.
Could also just be an error specific to the module and Python version combo you're trying.
From a discussion in the comments:
I have the pyenv-win version manager, so I was able to create venvs and test this for you. With Python 3.10.2, it fails; with Python 3.8.10, it's successful. So, yes, reinstalling does seem to be worthy of your time.
With python3.10
On Windows: First, install vcpkg and install sentencepiece:x64-windows-static
copy the header and lib files from vcpkg/installed/x64-windows-static/include and lib to
C:/Program Files/python310/build/root/include and lib
This should work as the setup.py install expects the library in a ..\build\root\lib directory.
As the C:\Program Files\python310\lib is in the /LIBPATH, the resulting ..\build\root\lib will point to the sentencepiece.lib
If still encounting errors, then set the INCLUDE and LIB environment variables so that the cl.exe , which is called from pip install sentencetransformers finds them.
People having windows+python 3.10 env, here are exact steps to install it via vcpkg.
Other instructions are covered in zweistein's answer.
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install sentencepiece:x64-windows-static

How to install Boost.Python on Windows 7 in order to install a python package?

I want to install the pyvlfeat package. It requires Boost.Python.
When I run the command
python.exe setup.py build
I receive the following message:
C:\Users\alex\Anaconda\Scripts\gcc.bat -DMS_WIN64 -mdll -O -Wall -IC:\Users\A
lexkow\AppData\Roaming\Python\Python27\site-packages\numpy\core\include -Ivlfeat
/ -IC:\Users\alex\Anaconda\include -IC:\Users\alex\Anaconda\PC -c vlfeat/m
ser/vl_erfill.cpp -o build\temp.win-amd64-2.7\Release\vlfeat\mser\vl_erfill.o -m
sse2 -O2 -fPIC -w
In file included from vlfeat/mser/vl_erfill.cpp:7:0:
vlfeat/mser/../py_vlfeat.h:18:28: fatal error: boost/python.hpp: No such file or
directory
Which tells me Boost.Python is not installed correctly on my computer, or that I don't launch the python install command correctly.
The package INSTALL instructions are :
Building the Module on a Unix System --
The C++ wrappers require Boost.Python to be installed:
$ sudo apt-get install boost-python1.35-dev
pyvlfeat uses distutils, so to build the library:
$ python setup.py build
As I am on Windows I can't sudo apt-get, so I downloaded boost 1.57.0 and extracted it into
C:\Program Files\boost\boost_1_57_0
It did not change the result. And now I don't know what I should do:
When I read the documentation
The section 3: "No-Install Quick Start" explains how to build an extension module called extending and test it by running a Python script called test_extending.py. I don't think that is what I want to achieve and it seems outdated because it talks about the bjam build driver.
The section 4: "Installing Boost.Python on your system" looks more interresting, but it says the information is in the Getting Started Guide, and it is not.
How to install Boost.Python on Windows 7 in order to install a python package ? ?
I am looking at the setup.py file. It looks like you can set BOOST_PATH at the top. You should set that to the correct path to the Boost you downloaded, I think.

installing python module on windows 8

I am doing a project in python where I have a very large dataset where I have to do a fisher exact test. This must be done 600,000,000 times so efficiency is quite important. However, with the scipy package this takes 50 hours, but I have read that https://pypi.python.org/pypi/fisher/ should be much faster. But I don't understand how to get it installed in Windows 8.
I have tried using: python setup.py install, this gives the error:
D:\Programmer\Python\Scripts\fisher-0.1.4>python setup.py install
running install
running build
running build_py
running build_ext
building 'fisher/cfisher' extension
error: Unable to find vcvarsall.bat
what is wrong?
This is how you do it:
Type into the Command Prompt window:
set path=%path%;C:\Python27\
And hit enter.
Use the complete path to the folder using CD.
eg: cd c:\Users\fisher-0.1.4
Then type python setup.py install

Python Selenium noarch RPM build failure

Attempting to build Python Selenium noarch rpm from downloaded selenium-2.20.0.tar.gz
All necessary Python requirements are installed and working, using command:
python setup.py bdist --format=rpm
RPMBuild fails with error message:
Arch dependent binaries in noarch package
error: command 'rpmbuild' failed with exit status 1
Have tried following the suggestion of adding an additiional %define to the selenium.SPEC file, found under build/bdist.linux-i686/rpm/SPECS/selenium.spec
%define _binaries_in_noarch_packages_terminate_build 0
Unfortunately when i re-run the RPM build, the change is not picked up and the contents of the SPEC file after the build seem to have re-verted as the newly added %define is no longer present?!
Any suggestions welcome please..
Changes to selenium.spec weren't persisting as the spec file is automatically generated from content mostly from within setup.py
Two solutions were found:
1) Download most recent version of selenium-2.20.0.tar.gz from http://pypi.python.org/pypi/selenium/ to target machine, tar extract and run:
python setup.py install
2) Install python pip, then use pip to dowload and install the latest selenium in an automated fashion with the command:
pip install -U selenium
As yet i have not found the exact content that can be added to setup.py that will add the necessary RPM build define to the selenium.spec file for creating an installation RPM..
For the future if anyone comes across this
python setup.py bdist_rpm --force-arch x86_64
Worked for me

Categories