I am trying to follow this tutorial and getting an error when I do the following:
(DataVizProject) $ pip install -r requirements.txt
It gives me a big error log, the last few lines of which are :
C:\python\new-coder\dataviz\DataVizProj\build\numpy\numpy\distutils\system_info.
py:1422: UserWarning:
Lapack (http://www.netlib.org/lapack/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [lapack_src]) or by setting
the LAPACK_SRC environment variable.
warnings.warn(LapackSrcNotFoundError.__doc__)
error: Unable to find vcvarsall.bat
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in C:\python\new-coder
\dataviz\DataVizProj\build\numpy
I know it doesn't work because when I do the following steps:
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpy
>>> import matplotlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named matplotlib
>>>
Thanks a lot!
#Hasnain, when you are using python in windows, eventually you will see this error for some packages.
You have three options when it happen (in order of relevance):
1 - Try to download a MSI file. It will install the library without any problems. To numpy specifically you can download here (http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy)
2 - You can download the whole file and try a python setup.py install and modify the packacge if it raise some errors.
3 - You can compile your own library for your operational system.
Many MSI files you can find here (http://www.lfd.uci.edu/~gohlke/pythonlibs/)
The method recommended in that tutorial works well for Unix systems. If you are on Windows you will go through a lot of trouble trying to build numpy from sources with pip. I will save you some time, follow the official recomendation and try some binary install of the recommended ones in the official Scipy website. I personally recommend you the Anaconda or the Enthought distribution.
Usually when installing packages on windows, by default python searches for Visual Studio 2008 . You can either install it or use MinGW Compiler.
If you decide to use MinGW you should edit your distutils.cfg file in Python27\Lib\distutils directory :
[build]
compiler = mingw32
[build_ext]
compiler = mingw32
Related
I am trying to install pyscipopt. This should be done using pip install pyscipopt. The only catch is that pyscipopt requires the SCIP Optimization suite. Here is where I am having trouble. I wanted to make sure that my basic steps were correct.
The first way:
Following (https://github.com/SCIP-Interfaces/PySCIPOpt/blob/master/INSTALL.md)
Download SCIP optimization suite from https://www.scipopt.org/index.php#download
Then cd to my downloads folder. There, there is
scipoptsuite-7.0.1.tar
Run
tar xvfz scipoptsuite-7.0.1.tar
cd scipoptsuite-7.0.1
Then, following (https://scipopt.org/doc/html/CMAKE.php)
mkdir build
cd build
cmake ..
make
make check
make install
Alternatively, I also tried using make (https://scipopt.org/doc/html/MAKE.php)
I then either set export SCIPOPTDIR=<path_to_install_dir>, where <path_to_install_dir> is the path to scipoptsuite-7.0.1, in my downloads directory, or I added the scipoptsuite-7.0.1 directory to my $PATH. Either way, pip install pyscipopt worked.
However,
Ultimately I get (on one machine)
>>> import pyscipopt
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/usr/anaconda/lib/python2.7/site-packages/pyscipopt/__init__.py", line 10, in <module>
from pyscipopt.scip import Model
ImportError: dlopen(/Users/usr/anaconda/lib/python2.7/site-packages/pyscipopt/scip.so, 2): Library not loaded: libscip.7.0.dylib
Referenced from: /Users/usr/anaconda/lib/python2.7/site-packages/pyscipopt/scip.so
Reason: image not found
On another machine I get
>>> import pyscipopt
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/s/Library/Python/2.7/lib/python/site-packages/pyscipopt/__init__.py", line 10, in <module>
from pyscipopt.scip import Model
ImportError: dlopen(/Users/sam/Library/Python/2.7/lib/python/site-packages/pyscipopt/scip.so, 2): Library not loaded: libscip.7.0.dylib
Referenced from: /Users/s/Library/Python/2.7/lib/python/site-packages/pyscipopt/scip.so
Reason: unsafe use of relative rpath libscip.7.0.dylib in /Users/s/Library/Python/2.7/lib/python/site-packages/pyscipopt/scip.so with restricted binary
Is anyone able to install this software on a mac and give me a step by step guide, so at least I know I am not making any obvious mistakes? I guess there may be problems with my computers that can not be resolved, but I wanted to just make sure I had pieced together the instructions from various links correctly..
Another things I tried was just downloading the sh and running
sh scipopsuite-[VERSION].sh. This is considerably faster than make/cmake, and gives me what seems to be required in terms of lib, include and headers, but then when I try to pip install pyscipopt I usually get errors of the form scip/scip.h no such file or directory, command gcc failed as in (https://github.com/SCIP-Interfaces/PySCIPOpt/issues/54).
After using the netCDF4-python package without any trouble, I needed to enable parallel file access. As I could not find suitable ready-made combinations of HDF5 and netCDF C libraries built against the same MPI library, I decided to build each of the packages from source with OpenMPI. However, importing the netCDF4 package fails due to unresolved symbols:
--------------------------------------------------------------------------- ImportError Traceback (most recent call
last) in
----> 1 import netCDF4
~/anaconda3/lib/python3.6/site-packages/netCDF4-1.5.1.2-py3.6-linux-x86_64.egg/netCDF4/init.py
in
1 # init for netCDF4. package
2 # Docstring comes from extension module _netCDF4.
----> 3 from ._netCDF4 import *
4 # Need explicit imports for names beginning with underscores
5 from ._netCDF4 import doc, pdoc
ImportError: /usr/local/lib/libnetcdf.so.15: undefined symbol:
H5Pset_dxpl_mpio
I tried installing the netcdf4-python package via pip install, and it imports works fine for serial file access, but still fails to load a file with parallel=True, stating that it requires parallel-enabled netcdf-c.
I am installing HDF5 with
export NCPROCS=4
export CC=mpicc
./configure --prefix=/usr/local/ --enable-parallel --enable-hl
make check
sudo make install
and netCDF-C with
export NCPROCS=4
export CC=mpicc
./configure --prefix=/usr/local/ --enable-parallel-tests
make check
sudo make install
and netCDF4-python using nc-config with
export CC=mpicc
python setup.py install
Each step recognizes the parallel functionalities. Am I missing a linking step in the build process somewhere, or why can't libnetcdf.so.15 find the symbols from the HDF5 library?
I have a problem when I'm trying to use OpenCV (v3.1.0) in Python (v3.4). To make things more complicated, OpenCV is built with the "contrib" package and Qt support (v5.5).
This is what I did (this has some pitfalls on it's own, but those are out of the scope of this question):
Install required software
I installed WinPython (v3.4.4, 64 Bit version)
I installed cmake (v3.6.0)
Download sources
I downloaded the Qt sources from the GIT repo
I downloaded the OpenCV sources from the GIT repo
I downloaded the OpenCV "contrib" sources from the GIT repo
build sources -> RELEASE, 64 Bit (!)
build Qt from sources
build OpenCV from sources (with "contrib" modules)
cmake ( OpenCV 3.1.0 for python 3 ) already took care of copying the "cv2.pyd" to the "your/python/folder/Lib/site-modules" directory.
Now I have the problem that calling "import cv2" from python gives the error "
>>> import cv2
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import cv2
ImportError: DLL load failed: Module not found
How can I find out which module is missing and how to solve it?
What you may not want to do is just adding paths that are likely needed to your environment variables.
There is a way to find out what is missing:
Download DependencyWalker
open your "cv2.pyd" with the dependency walker
Analyze your file (starts automatically when you select your file)
Hit "F9" such that it shows the full paths to the required DLLs
Check, which DLL files are missing
Copy them to those folders
For me, it was the case that python/cv2.pyd searched to all the Qt DLLs in the folder where cv2.pyd is in.
I just copied them there and that was it.
For Windows:
Step 1. Download python installer from https://www.python.org/downloads/
,install python by double clicking this file and check the option for adding python to PATH as in given image.
Step 2. Download file "numpy‑1.15.4+mkl‑cp27‑cp27m‑win32.whl" from unofficial site.
Go to this file's location open command prompt and type-
pip install numpy‑1.15.4+mkl‑cp27‑cp27m‑win32.whl
Now go to python IDLE and type:
import numpy
It should give no error.
Step 3. Download file "scipy‑1.2.1‑cp27‑cp27m‑win32.whl" from unofficial site.
Go to this file's location open command prompt and type-
pip install scipy‑1.2.1‑cp27‑cp27m‑win32.whl
Now go to python IDLE and type:
import scipy
It should give no error.
step 4 : Download file "opencv_python‑2.4.13.7‑cp27‑cp27m‑win32.whl" from unofficial site.
Go to this file's location open command prompt and type-
pip install opencv_python‑2.4.13.7‑cp27‑cp27m‑win32.whl
Now go to python IDLE and type:
import cv2
It should give no error, means opencv installed successfully in windows.
I tried to install libsvm downloaded from here http://www.csie.ntu.edu.tw/~cjlin/libsvm/
I already do the stepped written in the README which is
Building Windows Binaries
=========================
Windows binaries are in the directory `windows'. To build them via
Visual C++, use the following steps:
1. Open a DOS command box (or Visual Studio Command Prompt) and change
to libsvm directory. If environment variables of VC++ have not been
set, type
"C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat"
You may have to modify the above command according which version of
VC++ or where it is installed.
2. Type
nmake -f Makefile.win clean all
3. (optional) To build shared library libsvm.dll, type
nmake -f Makefile.win lib
I also copied the libsvm.dll to my windows32 folder.
I cant seem to find anything wrong but when I compiled a python code with "import svm" in it, I got the following error:
$ python analyze.py
Traceback (most recent call last):
File "analyze.py", line 2, in <module>
import baseline_classifier, naive_bayes_classifier, max_entropy_classifier, libsvm_classifier
File "D:\twitter-sentiment-analyzer-master\libsvm_classifier.py", line 1, in <module>
import svm
ImportError: No module named svm
Easy way to install:
Download libsvm's install binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/#libsvm
You might want to install libsvm‑3.17.win‑amd64‑py2.7.exe or libsvm‑3.17.win32‑py2.7.exe depending upon you windows config
I have installed the Emacs package jedi-emacs using M-x package install
and the following Python packages:
Jedi
EPC
argparse
using:
pip install --install-option="--prefix=~/.my_python_packages/" jedi
pip install --install-option="--prefix=/.my_python_packages/" epc
pip install --install-option="--prefix=/.my_python_packages/" argparse
since I do not have root priviledges.
When I open a Python file, I get the following error in the minibuffer, no matter where I place the cursor:
deferred error : (error Server may raise an error : Traceback (most recent call last):
File "/home/avazquez/.emacs.d/elpa/jedi-20130119.830/jediepcserver.py", line 261, in <module>
)
What could be causing it?
This is with Emacs 24.2.1
I found the solution to my problem. I did not have PYTHONPATH set up correctly (it should include the corresponding paths for /path/to/custom-packages).
For more info on this issue see the corresponding ticket in the package repository for emacs-jedi.