How do I install an updated scipy on the dotCloud platform? - scipy

Adding "scipy" to my requirements.txt file results in a number of errors. What else do I need to do? I see things like:
Running setup.py egg_info for package scipy
10:19:24 [www] /home/dotcloud/env/build/scipy/scipy/__init__.py:97: UserWarning: Numpy 1.5.0 or above is recommended for this version of scipy (detected version 1.3.0)
10:19:24 [www] UserWarning)
10:19:24 [www] Running from scipy source directory.
10:19:24 [www] blas_opt_info:
10:19:24 [www] blas_mkl_info:
10:19:24 [www] libraries mkl,vml,guide not found in /home/dotcloud/env/lib
10:19:24 [www] libraries mkl,vml,guide not found in /usr/local/lib
10:19:24 [www] libraries mkl,vml,guide not found in /usr/lib64
10:19:24 [www] libraries mkl,vml,guide not found in /usr/lib
10:19:24 [www] NOT AVAILABLE
etc.
(this question and answer are being migrated from answers.dotcloud.com)

The problem is that the version of numpy installed on the dotCloud Python service is too old, so you need to add the following to your requirements.txt file before scipy to upgrade to a newer version.
numpy==1.6.1
scipy also requires some system packages that aren't installed by default libatlas-base-dev and gfortran in order to build it correctly. You can add these in a systempackages section of your dotcloud.yml file, like this:
systempackages:
- libatlas-base-dev
- gfortran
Once you scipy to your requirements.txt and the systempackages to `dotcloud.yml, repush. This should fix your issue, and scipy will be installed.
It is also important to note that it will take a little while to build all of those items so the first push might take a few minutes, so don't be surprised if it is taking longer then usual.
(original answer from Ken Cochrane)

Related

ModuleNotFoundError: No module named 'cartopy' when import SkewT from metpy.plots under Python3

When trying to import SkewT into my python3 code on a Mac (Mojave 10.14.6):
from metpy.plots import SkewT
I get the error:
ModuleNotFoundError: No module named 'cartopy'
pip3 install cartopy gives the output
Collecting cartopy
Downloading https://files.pythonhosted.org/packages/e5/92/fe8838fa8158931906dfc4f16c5c1436b3dd2daf83592645b179581403ad/Cartopy-0.17.0.tar.gz (8.9MB)
|████████████████████████████████| 8.9MB 616kB/s
Installing build dependencies ... done
Getting requirements to build wheel ... error
ERROR: Complete output from command /usr/local/opt/python/bin/python3.7 /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpj50b1vfe:
ERROR: setup.py:171: UserWarning: Unable to determine GEOS version. Ensure you have 3.3.3 or later installed, or installation may fail.
'.'.join(str(v) for v in GEOS_MIN_VERSION), ))
Proj 4.9.0 must be installed.
----------------------------------------
ERROR: Command "/usr/local/opt/python/bin/python3.7 /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpj50b1vfe" failed with error code 1 in /private/tmp/pip-install-b5cu8485/cartopy
To start, I tried to install Proj and geos, but pip3 only lists version 0.1.0 for proj and 0.2.2 for geos. Before I get too far down this rabbit hole, I thought I'd see if anyone else has encountered this problem. Thanks!
So it looks like MetPy 0.10 accidentally picked up a hard dependency on CartoPy, which we did not really plan. You can track our resolution of that here.
CartoPy depends on a lot of compiled libraries that are not pip-installable unfortunately. Your best bet is to look at CartoPy's install instructions. If you're using Anaconda or Canopy, those distributions have pre-built CartoPy packages available.
One option to work around this is to install MetPy 0.9:
pip install metpy==0.9
Do you use Conda? The easiest way to remedy this problem is to install CartoPy (or MetPy for that manner) via conda, so that all of the right dependencies are also downloaded: conda install -c conda-forge cartopy or conda install -c conda-forge metpy. Pip doesn't bring all of them together, so that leads to this problem being raised.
Thanks. Without conda, I was also able to complete this (more painful) installation:
- brew install geos
- brew install proj
- pip3 install cython
- pip3 install git+https://github.com/SciTools/cartopy.git#master 
(see http://louistiao.me/posts/installing-cartopy-on-mac-osx-1011/)

Getting scipy to work in cygwin

I know that others have struggled with this problem, but I don't know what I'm doing wrong. I have installed anything I can see related to gcc, BLAS, or LAPACK in the cygwin packages window, but I still get a long list of errors when I do pip install scipy. I see things like
Running from scipy source directory.
Splitting linalg.interpolative Fortran source files
blas_opt_info:
blas_mkl_info:
libraries mkl,vml,guide not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/']
NOT AVAILABLE
openblas_info:
libraries openblas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/']
NOT AVAILABLE
The last error I see is:
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-8lzrOH/scipy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-nzff
hk-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-8lzrOH/scipy
Can someone help me out with this? Numpy is working without any problems.
In Cygwin Setup, install liblapack-devel (openblas will come as dependency). Then you can install scipy with pip install scipy.

Install Mapnik on Centos 7: ICU C++ Library Not Found

Problem/Introduction:
I'm trying to install Mapnik on Centos 7. I've had about a year UNIX experience in the professional environment, but I am still very much a beginner. I've compiled and installed boost which to my knowledge comes with ICU C++ Libraries. Unfortunately when I run ./configure for Mapnik installation I get the following error:
Exiting... the following required dependencies were not found:
- icuuc (ICU C++ library | configure with ICU_LIBS & ICU_INCLUDES or use ICU_LIB_NAME to specify custom lib name | more info: http://site.icu-project.org/)
How do I install this library? I can't find any good internet resources, or maybe I'm looking in the wrong places.
Thanks in advance.
yum install freetype-devel libtool-ltdl-devel libpng-devel libtiff-devel libjpeg-devel gcc-c++ libicu-devel python-devel bzip2-devel boost libwebp-devel libtiff-devel libjpeg-turbo-devel libpng-devel sqlite-devel gdal-devel gdal-python
wget https://mapnik.s3.amazonaws.com/dist/v3.0.10/mapnik-v3.0.10.tar.bz2
tar -xf ./mapnik-v3.0.10.tar.bz2
cd ./mapnik-v3.0.10/
./configure
make && make install
Mapnik v3.0.10 needs Boost of minimum version v1.56
CentOS 7 is shipped with version v1.53

Which missing library results in the message '/usr/bin/ld: cannot find -lglib-2.0'?

I am cross compiling a Lazarus program, creating a 32bit program on a 64bit Ubuntu 14.04 Trusty Tahr system, and everything apparently compiles to the very end when I get this messsage
/usr/bin/ld: cannot find -lglib-2.0
What is the full name of the library whose absence results in this error mesage?
libc6-dev:i386 appears to be the most likely library, but when I try to install it with apt indicates build-essential g++ gcc gcc-multilib will be removed so I abort it.
sudo apt-get install libc6-dev:i386
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
linux-libc-dev linux-libc-dev:i386
Suggested packages:
glibc-doc:i386 manpages-dev:i386
Recommended packages:
gcc:i386 c-compiler:i386
The following packages will be REMOVED
build-essential g++ gcc gcc-multilib
The following NEW packages will be installed
libc6-dev:i386 linux-libc-dev:i386
The following packages will be upgraded:
linux-libc-dev
1 to upgrade, 2 to newly install, 4 to remove and 18 not to upgrade.
Need to get 3,126 kB of archives.
After this operation, 12.6 MB of additional disk space will be used.
Do you want to continue? [Y/n]
It turns out it was the libglib2.0-0:i386 package. It was already installed earlier, but it had not been fully configured.
It was present in the /lib/i386-linux directory and I had to create a symlink to it include it to the fpc.cfg configuration file used by Free Pascal.
locate libglib | grep ^/lib produced:
/lib/i386-linux-gnu/libglib-2.0.so.0
/lib/i386-linux-gnu/libglib-2.0.so.0.4002.0
/lib/x86_64-linux-gnu/libglib-2.0.so.0
/lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0
I symlinked it with the expected name:
ln -s /lib/i386-linux-gnu/libglib-2.0.so.0 /lib/i386-linux-gnu/libglib-2.0.so
then added to the Lazarus installations fpc.cfg file
#ifdef cpui386
-Fl/usr/lib32
-Fl/lib/i386-linux-gnu
#endif

pip install PIL doesn't install into virtualenv

How do I install PIL?
>pip install PIL
Downloading/unpacking PIL
Could not find any downloads that satisfy the requirement PIL
Some externally hosted files were ignored (use --allow-external PIL to allow).
Cleaning up...
No distributions at all found for PIL
Storing debug log for failure in /root/.pip/pip.log
>pip uninstall PIL
Can't uninstall 'PIL'. No files were found to uninstall.
pip install PIL --allow-external PIL --allow-unverified PIL
This is due to changes in the new version of Pip. Run pip --version and I'm willing to bet you are running 1.5. See the changelog here. This new default behavior enhances security. In PIL's case, the file you are installing actually comes from effbot.org (thus --allow-external) and PyPi doesn't have a checksum to guarantee validity (thus --allow-unverified).
Also, you might consider using the Pillow replacement to PIL.
Updated info for those reading in 2016:
--allow-external
and
--allow-unverified
were recently deprecated. Installing packages external to PyPi using pip is no longer supported: http://www.python.org/dev/peps/pep-0470/
As an alternative, when you really need to install that external package, you can download the source code and run its setup.py. For example, for PIL 1.1.7, download from http://www.pythonware.com/products/pil/, then:
$ tar xvfz Imaging-1.1.7.tar.gz
$ cd Imaging-1.1.7
$ python setup.py install
(^ from the PIL README)
If you only want to install the package to a specific virtualenv, you can just activate your virtualenv first. ** thanks #Caumons
Alternatively, substitute the path to your virtualenv for 'python' in the third line, e.g.:
$ /home/username/virtualenv-name/bin/python setup.py install