I am trying to automate installation of miniconda and some packages thereafter within a singularity definition file to build an image. I am always getting the following error:
/.post.script: 10: conda: not found
FATAL: While performing build: while running engine: exit status 127
Assuming that one has to restart shell after installing conda, is there any way to automate this? The definition file is written below.
Bootstrap: docker
From: ubuntu:22.04
%post
apt-get update
apt-get -y install gfortran
apt-get -y install build-essential
apt-get -y install manpages-dev
apt-get -y install libgeos-dev
apt-get -y install wget
wget -c https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
/bin/bash Miniconda3-latest-Linux-x86_64.sh -bfp /opt
conda update conda
conda update python
conda install pip -y
pip install -y setuptools>=65.6
pip install -y cartopy==0.21.0
pip install -y contextily==1.2.0
pip install -y fiona==1.8.21
pip install -y pyproj==3.3.1
pip install -y rtree==1.0.1
pip install -y Shapely==1.8.2
pip install -y numpy==1.23.0
pip install -y pandas==1.4.3
pip install -y geopandas==0.11.0
pip install -y joblib==1.2.0
pip install -y matplotlib==3.6.2
pip install -y mercantile==1.2.1
pip install -y pytest==7.2.0
pip install -y python_dateutil==2.8.2
pip install -y pytz==2021.3
pip install -y timezonefinder==6.1.6
pip install -y pyarrow==10.0.0
OK so I am a total noob and I just installed Kali Linux. I am trying to install python-pip by command
apt-get install python-pip
and I am getting this output
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-pip
I've checked my source /ect/apt/sources.list and it says
deb http://http.kali.org/kali kali-last-snapshot main non-free contrib
I've run apt-get updates several times too and it's not helping. Please help.
At-First Open Your sources.list File With any Editor.
nano /etc/apt/sources.list
and add these Lines.
deb http://http.kali.org/kali kali-rolling main non-free contrib
deb-src http://http.kali.org/kali kali-rolling main non-free contrib
Not Update and Upgrade Your Kali Linux Using These Commands.
apt-get update
apt-get upgrade
and then Install pip using this command
apt-get install python-pip #For Python2
apt-get install python3-pip #For Python3
There is a high chance python-pip is not available, because 'python' is python2, and python2 is finally dead. Try to install python3-pip.
There is a convention that python without '3' is python2, and it's gonna last like that, I think, forever, due to compatibility reasons.
cd /
cd etc/apt/
sudo nano sources.list
After opening the editor paste the following line if not present.
deb http://http.debian.net/debian jessie-backports main
deb http://http.kali.org/kali kali-rolling main contrib non-free
run the following command
sudo apt upgrade
sudo apt install python-pip
This should work for you.
Try running apt-get install python3-pip. This will install pip3 on your machine.
I tried with sudo apt install python3-pip and didn't work. So I tried again with sudo apt-get install python3-pip and it worked fine. I'm using Kali Linux too.
You need to add the repositories to sources.list
nano /etc/apt/sources.list
And add
deb http://http.kali.org/kali kali-rolling main non-free contrib
deb-src http://http.kali.org/kali kali-rolling main non-free contrib
Save and run
apt-get update
apt-get upgrade
apt-get install python-pip #or python3-pip
And type
pip --version #or pip3
To more info click here and here
Use this to install pip for python 2.7:
curl https://bootstrap.pypa.io/2.7/get-pip.py -o get-pip.py
python get-pip.py
Now you have:
$ pip --version
pip 20.3.4 from /home/kali/.local/lib/python2.7/site-packages/pip (python 2.7)
$ pip3 --version
pip 21.0.1 from /home/kali/.local/lib/python3.9/site-packages/pip (python 3.9)
apt-get update
apt-get upgrade
This works
sudo apt update
sudo apt install python3
sudo apt install python3-pip
python3 -m pip install -r
This video helped me: https://www.youtube.com/watch?v=9EHUGDnvqoA
Try following commands:
sudo apt-get install software-properties-common
sudo apt-add-repository universe
sudo apt-get update
sudo apt-get install python-pip
Hope it will help u!
Make your source.list like this
nano /etc/apt/source.list
deb http://http.kali.org/kali kali-last-snapshot main non-free contrib
deb http://http.kali.org/kali kali-rolling main non-free contrib deb-src
http://http.kali.org/kali kali-rolling main non-free contrib
Update Your kali
sudo apt-get update && upgrade
Now install python-pip
apt-get install python-pip or apt-get install python3-pip
It works for me:
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py && python get-pip.py
If already python 2.7 version is installed , first remove that in cmd terminal
Type >> sudo apt purge -y python2-minimal
then install python latest version
Type >> sudo apt install -y python3-pip
python is installed!
Not found pip try this command
1: sudo apt install python3-pip
2: pip3 install -r requirements.txt
3: /usr/local/bin/python3.10 -m pip install --upgrade pip
i have same issue that i was using python2 not python3 you may check your python version you have
Try this :
sudo apt update
sudo apt install python3
sudo apt install python3-pip
python3 -m pip install -r
I had the same issue, here is the command that helped me:
sudo apt install python-pip
This command will install pip to your system.
I have python3.7 and I want to install pip. However when I do the following:
sudo apt install python3-pip
It seems to download python version 3.6 and pip for that. Is there a way to not download python3.6 and just download pip for python3.7? It seems rather strange that pip is download a whole other package.
Download get-pip file
$curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Install pip for python3.7
$python3.7 get-pip.py
Check versions for both
$python3.7 -V && pip3 -V
Output:
Python 3.7.3
pip 19.1.1 from /usr/local/lib/python3.7/dist-packages/pip (python 3.7)
if you check apt show python3-pip output you see it depends on python3:any (>= 3.4~) so it doesn't strictly say I need python3.6
I assume that you didn't install python3.7 using apt so as a result apt doesn't recognize that you have python3 and it tries to install it for you.
Deadsnakes
You can use a ppa called deadsnakes.
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.7
Then check that is has been installed successfully by running python3.7 --version. To use pip you can run python3.7 -m pip install package.
Compiling from source
You can build Python by yourself, on Debian based systems you would do:
sudo apt-get update; sudo apt-get install make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
Download your preferred python version from https://www.python.org/ftp/python/
Then extract the tar archive and run make
./configure --enable-optimizations
make
sudo make altinstall
Then run python3.7 --version
try this.
python3.7 -m pip install pip
I am chasing down an install failure. I have a fresh ubuntu xenial install. I have several different projects, each one involving dependencies requiring a different version of python, including a gnuradio project which seems to have the reasonable expectation that pip points to python2.7. Here is the first part of what I've run:
$ sudo apt-get update
$ sudo apt-get -yq upgrade
$ sudo apt-get -yq install python-pip
$ sudo pip install --upgrade pip
$ sudo apt-get install -yq python3-pip
$ sudo pip3 install --upgrade pip
$ sudo apt-get update
$ sudo apt-get -yq upgrade
$ sudo apt-get -yq install python-dev python3-dev
$ sudo apt-get install --fix-missing python-apt
$ sudo pip install numpy scipy matplotlib pybombs virtualenv
$ sudo apt-get -yq install build-essential libffi-dev libssl-dev python3-setuptools
$ sudo pip3 install --upgrade setuptools wheel
$ sudo pip3 install numpy scipy matplotlib virtualenv
$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt-get install python3.6
$ sudo apt-get -yq install python3.6-venv python3.6-dev
$ sudo apt-get update
$ sudo apt-get upgrade
No complaints so far, when I check pip and pip3, they point where I want them to point:
$ pip -V
pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)
$ pip3 --version
pip 9.0.1 from /usr/local/lib/python3.5/dist-packages (python 3.5)
Now I create a virtual environment for python3.6, enter it, in there pip points to python3.6 as expected, I install a few more packages, then exit the virtual environment and suddenly pip points to python3.5
$ mkdir projvenv
$ python3.6 -m venv /home/username/projvenv/
$ source /home/tom/vertexprojvenv/bin/activate
(projvenv) $ pip -V
pip 9.0.1 from /home/tom/projvenv/lib/python3.6/site-packages (python 3.6)
(projvenv) $ pip install numpy scipy matplotlib
(projvenv) $ deactivate
$ pip -V
pip 9.0.1 from /usr/local/lib/python3.5/dist-packages (python 3.5)
I have looked at this question which seems to address a purely anaconda issue, while the solution does not apply in my case. This discussion is more to the point, and points to a problem with pip. That particular bug is at least not quite what is going on for me since I am able to upgrade both pip pointing to python2.7 and pip3 pointing to python3.5, and the pip hijacking is not initiated by an upgrade. Any wisdom shed on this problem is much appreciated.
(edit)
$ which pip
/usr/local/bin/pip
$ head -1 `which pip`
#!/usr/bin/python3
Restore shebang line in /usr/local/bin/pip — make it #!/usr/bin/python2.
PS. Well, formally it's not a complete answer because the question is "How to prevent?" I don't know what program changed shebang line; but I doubt it was virtual environment.
I installed libmemcached 0,37 and ln -s /usr/local/lib/libmemcached.so.2 /usr/lib/libmemcached.so.2
but when I run manage.py
it still return
import _pylibmc
RuntimeError: pylibmc requires >= libmemcached 0.32, was compiled with 0.31
I try to install newer libmemcached,but they donot have the file libmemcached.so.2
You just need to install these dependencies before installing pylibmc
sudo apt-get install -y libmemcached-dev zlib1g-dev libssl-dev python-dev build-essential
pip install pylibmc
Here is gist on Github that helps you.
You should install python-memcached
You can install like this,
sudo pip install python-memcached
OR
sudo apt-get install python-memcache
python2.7-dev if not installed, you have to install like this,
sudo apt-get install python2.7-dev