pip3 packages are being installed in ~/.local folder - pip

I recently upgraded to ubuntu 20.04 LTS. As python3.8 was preinstalled, I installed pip using the command sudo apt install python3-pip , and I started installing python3 libraries. All the libraries I install are being installed into ~/.local/lib/Python3.8/site-packages folder. If I remember correctly, these packages should be installed into /usr/local/lib/python3.8/dist-packages.
madhan#madhan:~$ pip3 show tensorflow
Name: tensorflow
Version: 2.2.0
Summary: TensorFlow is an open source machine learning framework for everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: packages#tensorflow.org
License: Apache 2.0
Location: /home/madhan/.local/lib/python3.8/site-packages
After the packages are installed, I get a warning saying ~/.local/bin is not included in $PATH variable.
Installing collected packages: appdirs, cachelib, pygments, cssselect, lxml, pyquery, howdoi
WARNING: The script pygmentize is installed in '/home/madhan/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The script howdoi is installed in '/home/madhan/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed appdirs-1.4.4 cachelib-0.1 cssselect-1.1.0 howdoi-1.2.1 lxml-4.5.1 pygments-2.6.1 pyquery-1.4.1
even if ~/.local/bin is not included in $PATH variable, I am still able to import the packages.
madhan#madhan:~$ python3
Python 3.8.2 (default, Apr 27 2020, 15:53:34)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
>>>
Does anybody know why this is happening? How do I change the default folder to which pip3 packages are installed. Is it okay leave the packages in ~/.local folder or will it be a problem in the future?

Related

Installing python-igraph for python 3.6 on Windows

I want to install the python-igraph package, but I am currently using python 3.6.1 and I don't find any installer for this new version of python. Do you know how can I install python-igraph for this version?
I have tried to install python-igraph for older versions from anaconda cloud but a version problem occurs.
!conda install -c vtraag python-igraph
Fetching package metadata .............
Solving package specifications: .
UnsatisfiableError: The following specifications were found to be in conflict:
- python 3.6*
- python-igraph -> python 3.5*
Use "conda info <package>" to see the dependencies for each package.`
I know that python-igraph exists for older python versions, but I don't want to overwrite the current python 3.6 version, so I think I need a new environment to install the older version and be able to use both.
I have already tried to create a new environment for python 3.5:
!conda create -n py35 python=3.5 ipykernel
But after 30min I didn't obtain any response...
I have also followed the same procedure to install a package for python 2.7 (from marufr contributor), but I get the same problem creating an environment for python 2.7.
Note: I am working from Jupyter notebook on Windows (win-64) and using Anaconda.
Update:
Solution found here:
https://medium.com/towards-data-science/environment-management-with-conda-python-2-3-b9961a8a5097
Since there is no python-igraph for python 3.6 yet, I have to use an older version.
First, from Anaconda Prompt, install the nb_conda_kernels package before creating the new environment:
conda install nb_conda_kernels
Then, create the environment where I will work with the older python version:
conda create -n py35 python=3.5 ipykernel
Finally, install the package through the wheel (found here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#python-igraph)
pip install python_igraph‑0.7.1.post6‑cp35‑none‑win_amd64.whl (You have to this command in the same folder that you donwloaded the wheel!)
There is a Windows installer for igraph‘s Python interface on the Python Package Index. Download the one that is suitable for your Python version (currently there are binary packages for Python 2.6, Python 2.7 and Python 3.2, though it might change in the future). To test the installed package, launch your favourite Python IDE and type the following:
import igraph.test
igraph.test.run_tests()
The above commands run the bundled test cases to ensure that everything is fine with your igraph installation.
Now, you can download 'python_geohash‑0.8.5‑cp36‑cp36m‑win_amd64.whl'.
Use the following command to install:
pip install python_geohash‑0.8.5‑cp36‑cp36m‑win_amd64.whl
Then you can use python-igraph in your Python3.6

How to install GLIBC_2.14 without admin right

I want to use gdc-client, however, after I download it and run it. the system reported as:
./gdc-client: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /tmp/_MEI5oSpPi/libz.so.1)
It is our University Server, I don't have any admin right. Do you know how to install GLIBC_2.14 without admin right?
[shg047#tscc-login2 software]$ lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.6 (Final)
Release: 6.6
Codename: Final
[
gdc-client github issued this problem that glibc 2.12 is the latest that's available for CentOS 6.
If your system is CentOS release 6.6, I think you should download the gdc-client source code and compile it yourself. gdc-client is based on the py2.
git clone https://github.com/NCI-GDC/gdc-client
python setup.py install
You may meet the problem
The 'lxml==3.5.0b1' distribution was not found and is required by gdc-client
or
ImportError: /usr/lib64/libxml2.so.2: version `LIBXML2_2.9.0' not found (required by lxml/etree.so)
You need to install libxslt and libxml2 in your home path. And add xml2-config and xslt-config to your path. export PATH="/prog_path/libxslt-1.1.29/bin:/prog_path/libxml2-2.9.4/bin:$PATH"
Then
pip uninstall lxml
pip install lxml==3.5.0b1 --install-option="--auto-rpath"
Finnaly, compile gdc-client source code.
python setup.py install
It worked.

Finding and uninstalling PIL on Mac

I want to install Pillow and have read in many places this only works if PIL is removed.
Somewhere I have PIL installed but I am unable to find it or remember how it was installed. I'm pretty much a ctrl+c and ctrl+v guy when it comes to installing things through terminal, so I imagine I had some trouble installing it in the first place.
I have tried
pip uninstall PIL
easy_install uninstall PIL
brew uninstall PIL
and run out of ideas. I can't even find any file with name "PIL" with spotlight.
Just want to find a way to get rid of PIL and install Pillow so I can add text to a few hundred images.
Running python 2.7 on El Capitan
To find where PIL is located on your machine, use Python to import it and have it print out its location:
$ python
Python 2.7.10 (default, Jul 14 2015, 19:46:27)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import PIL
>>> PIL.__file__
On my system, this gives:
'/Library/Python/2.7/site-packages/PIL/__init__.pyc'
From this you can see where your site-packages directory is located. Now exit python, go into /Library/Python/2.7/site-packages/ (your exact path may differ from mine) and delete the folder PIL. That should get rid of it.
cd /Library/Python/2.7/site-packages/
sudo rm -rf PIL

My Pip points to the wrong path and cannot install packages inside a virtualenv

I want to create a virtualenv with python3.4 and pip3 on ubuntu 14.04 but I cannot do it. I've tried in my normal ubuntu14.04LTS machine and in a new one from livecd to check it again from scratch but I cannot make it work. I've tried virtualenv (with and without virtualenvwrapper) and a lot of different commands, tools and scripts I've found around with no luck. Two days lost with this, messing with Python2.7 and specially pip different versions. Let me explain as detailed as possible to help you understand:
As you know, Ubuntu 14.04LTS comes with Python3.4 installed by default and this Python version comes with a tool called py-venv-3.4 so you don't need to use virtual-env and that's the way I'm trying now.
From the clean live-cd I try the following:
sudo apt-get update
sudo pyvenv-3.4 my env
It throws an error:
Error: Command '['/home/ubuntu/Desktop/mi_entorno/bin/python3.4', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1
so I have to create it without pip to make it work.
sudo pyvenv-3.4 --clear --without-pip my_env
sudo source my_env/bin/activate
From now on, I'm inside the virtual environment.
At this point I'm good because inside the environment the python command points to the right version (3.4). First common issue solved. But the problem comes with pip. Of course as I checked "without-pip" pip3 doesn't work and I have to install it.
sudo apt-get install python3-pip
sudo pip3 --version
And the fun comes:
pip 1.5.4 from /usr/lib/python3/dist-packages (python 3.4)
It's pointing the right version of python, but not the inner one but the outer, for no reason (Outside, pip3 is uninstalled by default!). But just to make sure this is wrong I try to install django in the environment and check it.
sudo pip3 install django
sudo python
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'django'
>>>
Great. Now I go outside the environment back to my "normal" shell:
deactivate
python3
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.VERSION
(1, 6, 5, 'final', 0)
>>>
And django works as expected cause pip installed it outside the environment. I'm new to Python packaging dependencies and I've lost close to 20 hours with this in my last two days. Does anyone have a simple way to create a single virtual environment on ubuntu14.04 with python3.4 and pip3? I don't think I'm asking for much :(
Any help is a blessing.

Anaconda Pymc Install

When attempting to install pymc via conda, I receive the following:
C:\Anaconda>conda install -c https://conda.binstar.org/pymc pymc
Fetching package metadata: ...
Error: No packages found matching: pymc
The install is from the pymc distribution page: https://binstar.org/pymc/pymc
My current version of anaconda is up to date:
C:\Anaconda>conda update --prefix C:\Anaconda anaconda
Fetching package metadata: ..
Solving package specifications: .# All requested packages already installed.
# packages in environment at C:\Anaconda:
#
anaconda 1.9.2 np18py27_0
So as a conda newbie, I'm not quite sure what I'm missing. Perhaps I have to authorize binstar first? (No proxy issues I believe.)
Much appreciate your suggestions!
That build of pymc is only built for OS X 64-bit, Windows 32-bit, and Linux 64-bit (see https://binstar.org/pymc/pymc/2.3.2/files). I'm guessing you have Windows 64-bit. You should contact the pymc devs to see if they can build a 32-bit Windows version.
Try using:
!conda install pymc --yes
It should work. The --yes here used to skip a pause.
You can try to install an unofficial version for Windows 64-bit from here http://www.lfd.uci.edu/~gohlke/pythonlibs/

Resources