scipy missing libifport.so.5 - scipy

I am trying to install scipy 0.10.1 on Ubuntu 10.10 using pip.
I have successfully installed numpy:
$ sudo pip install --upgrade numpy
[snip]
Successfully installed numpy
Cleaning up...
but when I try scipy I get:
$ sudo pip install --upgrade scipy
[snip]
File "/usr/local/lib/python2.6/dist-packages/numpy/linalg/linalg.py", line 23, in <module>
from numpy.linalg import lapack_lite
ImportError: libifport.so.5: cannot open shared object file: No such file or directory
I do have libifport.so.5, but I don't know why the installer isn't finding it.
$ echo $LD_LIBRARY_PATH
:/opt/intel/composerxe-2011.2.137/compiler/lib/intel64
I have also tried to install several other packages in the hope that one of them might help (e.g. libatlas-base-dev liblapack-dev libatlas-base-dev liblapack-dev, etc)
Any thoughts?
Thank you.

Most likely you have not defined the LD_LIBRARY_PATH for root. To check this:
$ sudo su
$echo $LD_LIBRARY_PATH
You can specify environment variables as follows:
$ sudo env LD_LIBRARY_PATH=path/to/compiler' pip install scipy
Check out this blog post to create an alias to save you typing each time:
http://final-world-domination.blogspot.ch/2011/02/sudo-doesnt-export-ldlibrarypath.html

This fixed the problem for me on Debian 9:
conda install -c intel -c conda-forge -c pytorch --override-channels intel-fortran-rt
# find / -iname "libifport*"
./opt/conda/lib/libifport.so
./opt/conda/lib/libifport.so.5
./opt/conda/pkgs/intel-fortran-rt-2021.3.0-intel_3350/lib/libifport.so
./opt/conda/pkgs/intel-fortran-rt-2021.3.0-intel_3350/lib/libifport.so.5

Related

Issue while installing Scipy

I installed Scipy using the command sudo apt-get install python-numpy python-scipy and looks like the latest version of both are installed. But when I try to install a python package named wfdb using pip install wfdb, it get an error while Building wheel for scipy (PEP 517).
ERROR: Failed building wheel for scipy
Running setup.py clean for scipy
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] =
'"'"'/tmp/pip-install-
fhfmfpqi/scipy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-
fhfmfpqi/scipy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)
(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code,
__file__,
'"'"'exec'"'"'))' clean --all
cwd: /tmp/pip-install-fhfmfpqi/scipy
Complete output (9 lines):
`setup.py clean` is not supported, use one of the following instead:
- `git clean -xdf` (cleans all files)
- `git clean -Xdf` (cleans all versioned files, doesn't touch
files that aren't checked into the git repo)
Add `--force` to your command to use it anyway if you must (unsupported).
----------------------------------------
ERROR: Failed cleaning build dir for scipy
Failed to build scipy
ERROR: Could not build wheels for scipy which use PEP 517 and cannot be installed directly`
I upgraded pip using pip install --upgrade pip.
python version used: 3.7
Can I get some help on this?
Clean out the install (I don't know which system you're using) i.e. get rid of the $PATH variables and just do a fresh install.
If you're using Anaconda:
conda install -c anaconda scipy
should do it
also the goops old
pip install scipy
gets it done as well. May I ask why you approached your installation in this way (again, I don't know which system you're on)
Never do sudo pip. Instead do pip install --user. Or (better) work in a virtualenv.
EDIT: typo: there is no space between -- and user.

No module named '_tkinter' configured

ModuleNotFoundError: No module named '_tkinter'
I want to import turtle in Python 3.7
Traceback (most recent call last): File "my.py", line 1, in
from turtle import * File "/usr/local/lib/python3.7/turtle.py", line 107, in
import tkinter as TK File "/usr/local/lib/python3.7/tkinter/init.py", line 36, in
import _tkinter # If this fails your Python may not be configured for Tk ModuleNotFoundError: No module named '_tkinter'
When building python from source, if the Tk development files are missing,
the build ends with
The necessary bits to build these optional modules were not found:
_tkinter
The development files can be installed from the distribution packager.
for instance, in openSUSE Leap-15:
sudo zypper install tk-devel
The IDE tells you that your python is not confingured for Tk (tkinter), which is your problem. While I am not certain on how to fix this becuase I never use turtle or Tk, I have a few ideas.
I am using python 3.7 and importing both turtle and Tk works just fine for me, so I definitely recommend updating to 3.7.
Look for Tk in your python module library and reinstall it.
Just find out how to confingure Tk with python 3.2 if updating doesn't work.
I hope I helped!
As #ederag said, I have installed Python3.7 and tkinter in opensuse.
sudo zypper refresh
sudo zypper update
sudo zypper in zlib-devel bzip2 libbz2-devel libffi-devel libopenssl-devel readline-devel sqlite3 sqlite3-devel xz xz-devel gcc tk-devel tcl-devel
cd ~/Downloads
wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
tar xf Python-3.7.3.tar.xz
cd Python-3.7.3
./configure
make
sudo make altinstall
sudo ln -s /usr/local/lib64/python3.7/lib-dynload /usr/local/lib/python3.7/lib-dynload
if you are using linux go to terminal and type sudo apt-get install python3-tk
if you are using windows go to command prompt and type cd C:/Program Files/Python/python37/Scripts press enter then type pip install tkinter
hope it helped!

Installing Network-x

How do I download and install network-x for python version 3.4.0 on mac? Can someone give me a step by step guide on installing network-x? I tried to quick 'quick install' as suggested by github.
When I try to import it on python it gives me an import error saying no modules were found.
Ok so I have figured out an easier way:
(Answering my own question)
I first download the networkx-1.10.zip (md5) zip file from https://pypi.python.org/pypi/networkx. Unzipped it. Opened the terminal and typed cd
Then, I dragged and dropped the unzipped folder (networkx-1.10) into the terminal. Hit Enter.
Then I proceeded with the following commands:
python3 --version
ls
umask
sudo python setup.py install
sudo python3 setup.py install
python3
It worked like a charm.
this has worked for me
sudo pip install networkx
This should work:
sudo pip3 install networkx
if you have annaconda, in your terminal or cmd
> % conda install -c anaconda networkx
> % conda install -c anaconda graphviz
> % conda install -c anaconda pydot
> % conda install -c pdrops pygraphviz
The other packages come in handy as well
The easiest way is using Anaconda, since networkX is installed by default. Just follow the instructions on their website (they have both a graphical and command line installer).

pip - Requirement already satisfied?

pip recognize global installed packages..?! :-(
I've used virtualenvwrapper preactivate hook to clean PYTHONPATH,
export PYTHONPATH=""
then echo $PYTHONPATH returns empty string, but this didn't help.
What's wrong?
bentzy#lama:~$ mkvirtualenv test
New python executable in test/bin/python
Installing setuptools............done.
Installing pip...............done.
virtualenvwrapper.user_scripts creating /home/bentzy/.virtualenvs/test/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/bentzy/.virtualenvs/test/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/bentzy/.virtualenvs/test/bin/preactivate
virtualenvwrapper.user_scripts creating /home/bentzy/.virtualenvs/test/bin/postactivate
virtualenvwrapper.user_scripts creating /home/bentzy/.virtualenvs/test/bin/get_env_details
(test)bentzy#lama:~$ which pip
/home/bentzy/.virtualenvs/test/bin/pip
(test)bentzy#lama:~$ sudo pip install simplejson
Requirement already satisfied (use --upgrade to upgrade): simplejson in /usr/lib /python2.7/dist-packages
Cleaning up...
(test)bentzy#lama:~$ echo $PYTHONPATH
(test)bentzy#lama:~$ pip --version
pip 1.2.1 from /home/bentzy/.virtualenvs/test/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg (python 2.7)
You are using sudo to install simplejson, but if you use sudo your $PATH may be changed, and that seems to be the problem.
Just use pip install simplejson (no sudo included) and it is probably going to work.
Use sudo only when you want to affect your whole system.
Already satisfied means that you already install "it".
try:
pip uninstall simplejson
and then:
pip install simplejson

Installing psycopg2 into virtualenv when PostgreSQL is not installed on development system

Is it possible to install psycopg2 into a virtualenv when PostgreSQL isn't installed on my development system—MacBook Pro with OS X 10.6?
When I run pip install psycopg2 from within my virtualenv, I received the error shown below.
I'm trying to connect to a legacy database on a server using Django, and I'd prefer not to install PostgreSQL on my development system if possible.
Why not install PostgreSQL?
I received an error when installing PostgreSQL using homebrew. I have Xcode4—and only Xcode4—installed on my MacBook Pro and am thinking it's related to missing gcc 4.0. However, this is a problem for another StackOverflow question.
Update 8:37 AM on April 12, 2011: I'd still like to know if this is possible without installing PostgreSQL on my MacBook Pro. However, I ran brew update and forced a reinstallation of ossp-uuid with brew install --force ossp-uuid and now brew install postgresql works. With PostgreSQL successfully installed, I was able to pip install psycopg2 from within my virtualenv.
Error from pip install psycopg2
$ pip install psycopg2
Downloading/unpacking psycopg2
Running setup.py egg_info for package psycopg2
Error: pg_config executable not found.
Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
Complete output from command python setup.py egg_info:
running egg_info
writing pip-egg-info/psycopg2.egg-info/PKG-INFO
writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
warning: manifest_maker: standard file '-c' not found
Error: pg_config executable not found.
Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /Users/matthew/.pip/pip.log
Preliminary Research
Below are the articles I read as preliminary research:
Installing psycopg2 to use Django with PostgreSQL on OS X
Installing psycopg2 on OS X
Using psycopg2 with virtualenv on Ubuntu JauntyLucid
Postgres, psycopg2, virtualenv install hints
apt-get install libpq-dev
helped me on debian squeeze
From comments:
apt-get install python-dev-is-python3
psycopg depends on pg_config command, and if you don't have it, you can't install psycopg.
If system installation is a problem to you, why don't you try compiling PostgreSQL and including generated bin files in your $PATH? Like:
export PATH=/path/to/compiled/postgresql/bin:"$PATH"
pip install psycopg2
brew install postgresql
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
pip3 install psycopg2
apt-get install libpq-dev
helped me in debian squeeze too . After that do pip install psycopg2. I faced problem of pg_config not found problem when i was setting up my environment on heroku , now its working fine .
You need to install the python-dev package in order to make use of python extensions such as psycopg2. I don't know how to install packages in mac but I run the following commands to install a python package on my Ubuntu machine.
sudo apt-get install python-dev
Or
sudo apt-get install python3-dev
if you are using Python3.x.
Once the installation is finished run the following command within your virtual environment.
pip install psycopg2
You don't need the complete PostgreSQL installed: you only need the client side libraries.
I solved it in MAC OSX using :
$ wget https://ftp.postgresql.org/pub/source/v9.5.3/postgresql-9.5.3.tar.bz2
$ tar xfv postgresql-9.5.3.tar.bz2
$ cd postgresql-9.5.3
$ ./configure
$ make
$ cd src/bin/pg_config
$ export PATH=`pwd`:"$PATH"
$ pip install psycopg2
Use pip install psycopg2-binary, it worked for me when pip install psycopg2 wasn't working.
Using the method you described in your April 12th update, I was able to install PostgreSQL(+1). Note that I originally was running Python 2.7.1 (32bit) and homebrew threw several errors and warnings regarding using a 32bit version of Python. I have since switched the 64/32 bit version of 2.7.1 and it works like a champ.
Regarding the pyscopg2, I was able to install it into my virtual environment from source by editing setup.cfg. I set pg_config to correct path inside homebrew's Cellar (pg_config=/usr/local/Cellar/postgresql/9.0.4/bin/pg_config). After saving the changes, I ran python setup.py install with zero issues. It's worth noting that I did not set the Mac's default python setting to 32 bit. I used the new 64 bit from start to finish.
After looking over some of the documentation, I think if I added homebrew's postgresql path to the system path I could have used pip to install it.
Reference:
http://favosdream.blogspot.com/2009/09/make-psycopg2-and-readline-work-in-snow.html
Update 6-8-2011:
While porting a project written on OS X to Windows 7, I found out that I had to install PostgreSQL on Windows as well. This ended up creating another user on my start up screen and other things that I just didn't like. While doing some digging I found Windows drivers for PostgreSQL here. I have since uninstalled the full PostgreSQL and installed the ODBC drivers which, thus far, work great.
To address the original question, after doing a bit more digging I think I found the equivalent ODBC for OS X here. I have not had a chance to try them out, but the concept works very well on Windows 7. I will update this when I get a chance to try them out. Until then, I hope this helps.
All from the above doesn't work for me (OS Catalina 10.15.1)
There was a conflict with classical postgres and homebrew version.
Please delete homebrew version by command
$ brew uninstall postgresql
and then install it from the official website:
$ sudo mkdir -p /etc/paths.d && echo /Applications/Postgres.app/Contents/Versions/latest/bin | sudo tee /etc/paths.d/postgresapp
It is actual for a simple psycopg2 install or django-heroku package.
if you have recently updated python or changed default python (let's say from 3.6 to 3.8). The following code
sudo apt-get install python-dev OR sudo apt-get install python3-dev
will be installing/working for the previous python version.
so if you want this command to work for the recently updated/changed python version try mentioning that specific version like python3.8 in command like
sudo apt-get install python3.8-dev
try above with following
pip install wheel
export PATH=/path/to/compiled/postgresql/bin:"$PATH"
sudo apt-get install libpq-dev
sudo apt-get install python3.x-dev **Change x with your version, eg python3.8**
pip install psycopg2-binary
pip install psycopg2
As I never needed to install postgresql database on this server I installed the following libraries on Ubuntu 14_04 version before running pip install psycopg2 on the same server
apt-get install libpq-dev python-dev
and then executed pip install psycopg2 within virtual env.
Output
Collecting psycopg2
Using cached psycopg2-2.6.1.tar.gz
Building wheels for collected packages: psycopg2
Running setup.py bdist_wheel for psycopg2
Stored in directory: /root/.cache/pip/wheels/e2/9a/5e/7b620848bbc7cfb9084aafea077be11618c2b5067bd532f329
Successfully built psycopg2
Installing collected packages: psycopg2
Successfully installed psycopg2-2.6.1
I know you are asking for development environment but if you are deploying on server say, Heroku.
Just add below line in the requirements.txt of your project.
django-heroku==0.3.1
As this package itself will install the required packages like psycopg2 on server deployment.
Try to specify the version and it'll works, do it inside the venv
pip install psycopg2-binary==2.8.6
based on my experience, apt install libpq-dev then try to install psycopg2 inside venv will fix many issues, however for more information you can refer to this link:
https://www.psycopg.org/docs/install.html