Installing mpi4py and vcvarsall issue - python

Trying to install mpi4py and having an issue when I run
easy_install mpi4py
and get:
error: Setup script exited with error: Unable to find vcvarsall.bat
From reading literature on similar issues I figured it is a compiler issue, but I have no idea how to implement the fix mentioned in that problem. From mpi4py documentation I found
env MPICC=/path/to/mpicc easy_install mpi4py
I am on Windows and cmd doesn't allow me to run such command. I'm not too familiar with Windows command line, so dont know how to properly implement this fix, or is this even a correct fix?
easy_install mpi4py MPICC=/path/to/mpicc isnt an option as easy_install doesnt have an argument for passing down variables.
I am using OpenMPI
EDIT 1
vcvarsall.bat file is in my VS12 folder, so most likely it is the same issue as the outlined in above case. I am using Developer Command Prompt from VS12, and no luck either

I've never had luck getting python compiles to work on windows. Luckily I've never had a compelling need for it either. Can you try the unofficial binary installer?
If you need to install it to a virtualenv, first activate your virtualenv and then use easy_install "..." with the full path to the downloaded binary.
If you really need to compile it, you'll need to follow what all the other solutions say about getting compilation to work on windows.

Related

Can't install mpi4py with OpenMPI: Cannot compile MPI programs

it's my first post here so apologies if my style is wrong!
I've been trying to install mpi4py (as SU2 requires it for parallel processing) on Ubuntu 16.04 using python 3.6. I downloaded mpi4py and tried to build from source as I would like to use the OpenMPI libraries I had configured, and tried the following:
sudo python setup.py build --mpicc=/opt/openmpi/openmpi-2.1.0/bin/mpicc
However, it ultimately fails with "error: Cannot link MPI programs. Check your configuration!!!"
Looking at the SU2 and mpi4py documentation, they recommend using pip instead. I also tried this:
sudo pip install mpi4py
and env MPICC=/opt/openmpi/openmpi-2.1.0/bin/mpicc pip install mpi4py but they also gave the same error.
I have saved both outputs - please see the link for the attachments. It seems to pick up on a lot of the files from my NVIDIA CUDA installation, though I'm not sure why.
I'm a beginner at at compiling programs so I'd appreciate it if anyone could shed any light on this? Thanks.
Though its an old post but I will post my answer might help others.
I fixed this problem by following commands:
sudo apt install libopenmpi-dev
pip install mpi4py`
For anyone else who is struggling with this problem, it turned out to be a number of factors. Mainly, mpi4py was not building correctly as my implementation of MPI (openMPI) had not been properly built. There were many factors that differentiated building programs on an existing supercomputer and a fresh Linux install.
Some troubleshooting tips I can recommend are:
Make sure you clear away any environmental variables which are unnecessary for the install using unset
Unload any modules which may interfere with the install using module unload. This is especially true when building your own MPI implementation on a supercomputer which has several others loaded already.
Check your $PATH variable for any locations which may contaminate your install (not forgetting that the order is important)! You may want to temporarily set a cleaner PATH variable to make sure the build picks up the correct libraries.
Hope this helps.

Error installing python-docx

Trying to install python-docx through pip for 'Learn to Automate the Boring Things with Python'. I am getting errors like this.
I have Googled up some solutions to this issue, but they don't seem to work for me, or I am not deploying the solution correctly.
One post on Stackoverflow said to download an lxml file made available by Christoph Golke.
I downloaded, and then tried 'pip install lxml', and basically got the same error message as the screenshot, telling me 'Unable to find vcvarsall.bat'.
Am I supposed to put this file in a certain directory, before executing that command? Any help would be appreciated.
This mean that C++ Common Tools are not installed.
To install them for Python2.7 go to Microsoft Visual C++ Compiler for Python 2.7
For python3 install Visual Studio Community 2015 and execute the following command:
SET VS90COMNTOOLS=%VS140COMNTOOLS%
so I found the answer to this issue.
So I wasn't aware that to install the lxml file, you first need to change to the directory of that file, and type in the complete name of that file. Either that, or typing the path of the lxml file directly into the cmd prompt, like:
pip install C:\Users\yourName\Downloads\lxml-3.6.4-cp35-cp35m-win32
or
cd C:\Users\yourName\Downloads
pip install lxml-3.6.4-cp35-cp35m-win32
which successfully installed the lxml file, which then led to a successful installation of the python-docx file.
Essentially, a basic knowledge of the command prompt would've helped me avoid this problem...but hope this helps for anyone else who doesn't know what to do!

Installing modules reliably in one location

I've been working with Python for a little while now but have come to absolutely detest installing new modules. It always seems to take me a full work day to install one additional module. This last happened with mpl_toolkits and now it is happening with gdal.
The main issue seems to be that easy_install/pip/get-app aren't saving a file in the correct location and so Python (I'm using Spyder) can't find it. How do I install a module in a location so that Python can find it?
I have been reading guides, articles, manuals and Stack Overflow articles all day now and I feel this needs a new question as I can't find an answer.
It is installing fine, it's just Python (and I) can't find it
It's not in the /lib/python2.7/site-packages folder, which seems to be the Python default, although half the modules that do work aren't in there when I list it
I installed using:
sudo apt-get install gdal-bin
I also tried with:
pip install gdal
but this fails with the error:
Command "python setup.py egg_info" failed with the error code 1 in /tmp/pip-build-NWJT2f/gdal/
I looked for the files using
dpkg -L gdal
and then added the file path this said into Spyder's preferences option for PYTHONPATH, but it still couldn't find it and so I'm guessing this is wrong.
I have read the official documentation of PYTHONPATH, but it's very short and doesn't really explain it at all.
I recommend trying anaconda or miniconda, which manage environments and install packages - it 'just works'.
https://www.continuum.io/downloads

How to install python lib mahotas on linux with setup tools

I want to install the python library Mahotas on my Raspberry Pi 2 which runs rasbian, a special version of Debian. However, when I tried to use sudo apt-get install python-mahotas I got an error saying that the lib did not exist.
I then downloaded mahotas via the browser in the GUI hoping it would work that way. I unpacked the zip file into home/pi/Downloads/mahotas-1.4.0/ and ran python setup.py install It now returned an error saying that it needed setup tools in order to be installed correctly.
After some research on the internet, I installed those setup tools, using sudo apt-get install python-setuptools, which were now in the directory /usr/lib/python2.7/dist-packages/. Setup.py, in the mahotas directory, still said I needed setup tools so I copied the setup tools folder into the mahotas directory thinking that it might solve the problem to get them in the same directory. It did not.
I have googled a lot but I could not solve the problem. Does anyone know what the problem is with my attempts to install mahotas? I am new to linux so it might be something simple but i cannot find any solution.
Update 31-08:
I have tried what Dave suggested in the comments, but after some tries it still didn't work. The first command returned a bunch of 404's . The reason that I at first thought it would still work was because my internet does weird things, sometimes giving an error. That was not the case here I discovered later.
Does anyone else have a solution?

How do you install PyCallGraph / use pip?

and thanks to anyone who gives some of their time to consider my problem.
What I need help on is for someone to give me a simple and accessible explanation on how to install that module. I have never, ever used anything from PyPi before, I have only heard of pip after looking up PyCallGraph.
I'm not a programmer first, I'm doing an accounting internship and am using python to write scripts to help me speed up some processes, at the urging of a colleague who himself uses python. I write scripts using Notepad++ and execute them through IDLE.
I'm currently working on optimizing a script I wrote and came upon PyCallGraph while checking this very site on tips on how to do so.
I tried the very minimalistic instruction of just doing "pip install pycallgraph" just about anywhere I could think of, including cmd.exe, to no avail. Runing get-pip.py directly seems to have worked for installing pip, though.
Otherwise I can always just stick with the cProfile printout and write-off using modules needing such an install, although that saddly seems to be quite a few...
Step 1: Install PIP
Open terminal (cmd.exe, PowerShell, whatever)
Download get-pip.py and place it in the working directory of your terminal
Install PIP by invoking python get-pip.py
Confirm that PIP was installed correctly by invoking command pip (should display help if success)
If pip didn't work, make sure your PATH environment variable has been set up correctly. In typical Windows installations pip is installed under c:\Python27\Scripts. Make sure this folder is included in PATH.
Step 2: Install your library with PIP
Invoke pip install pycallgraph
PIP installs the library and it can be now used from Python

Categories

Resources