I'm trying to install this repo :
https://github.com/CMU-Perceptual-Computing-Lab/MonocularTotalCapture
on google colab. This is how I have installed conda and opencv=2.4.13 (it requires python 2.7 to work)
pip install conda
!wget -c https://repo.continuum.io/archive/Anaconda3-5.1.0-Linux-x86_64.sh
!chmod +x Anaconda3-5.1.0-Linux-x86_64.sh
!bash ./Anaconda3-5.1.0-Linux-x86_64.sh -b -f -p /usr/local
import sys
sys.path.append('/usr/local/lib/python3.6/site-packages/')
!conda install -y -q -c conda-forge opencv=2.4.13
Between the others packages,it requires also pyEDM,so I'm trying to install it. I'm following this guide :
https://github.com/SugiharaLab/pyEDM/issues/1
I don't get any error until this command :
!cd pyEDM; pip install .
that gives to me this error :
Processing /content/pyEDM
ERROR: Package 'pyEDM' requires a different Python: 2.7.15 not in '>=3'
Infact when I ask which versions of python I have,it says :
!python2 --version
Python 2.7.15
!python3 --version
Python 3.6.9
!echo $PYTHONPATH
/tensorflow-1.15.0/python3.6:/env/python
So,I should change the python version installed by conda when I have installed opencv 2.4.13 to a version of 3 or greater,otherwise the package can't be installed. On my local machine I would do that with this command :
!alias python='/usr/bin/python3.6'
but it does not work on colab. When I give the alias command it doesn't answer anything and the error is still there. What can I do ?
Related
I'm trying to install torch_geometric in a conda environment but I'm getting the following werror whenever I try to:
import torch_geometric
Error:
OSError: dlopen(/Users/psanchez/miniconda3/envs/playbook/lib/python3.9/site-packages/libpyg.so, 0x0006): Library not loaded: /usr/local/opt/python#3.10/Frameworks/Python.framework/Versions/3.10/Python
Referenced from: <95F9BBA5-21FB-3EA5-9028-172B745E6ABA> /Users/psanchez/miniconda3/envs/playbook/lib/python3.9/site-packages/libpyg.so
Reason: tried: '/usr/local/opt/python#3.10/Frameworks/Python.framework/Versions/3.10/Python' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/python#3.10/Frameworks/Python.framework/Versions/3.10/Python' (no such file), '/usr/local/opt/python#3.10/Frameworks/Python.framework/Versions/3.10/Python' (no such file), '/Library/Frameworks/Python.framework/Versions/3.10/Python' (no such file), '/System/Library/Frameworks/Python.framework/Versions/3.10/Python' (no such file, not in dyld cache)
This is how I installed the conda envrionment:
onda create --name playbook python=3.9.7 --no-default-packages
conda activate playbook
pip install torch==1.13.1 torchvision==0.14.1
pip install pyg-lib torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-1.13.0+cpu.html
Any idea how to solve this error?
Thanks a lot in advance!
If you check your error message, on the line "Referenced from" you can see Python version 3.9 but on the line "Reason tried", you have Python version 3.10.
So i think you are using a Python environment 3.10 with Python 3.9 or the opposite. You should recreate your environment cleanly.
I had this problem as well--I don't know why it wants Python 3.10 specifically. But I was able to resolve it by installing a global version Python 3.10:
https://www.python.org/downloads/macos/
This allows it to access Python 3.10 outside your virtual environment.
I had this problem as well.I used python3.7 it worked:
conda create -n pygeometric python=3.7
conda activate pygeometric
conda install pytorch torchvision -c pytorch
python -c "import torch; print(torch.version)"
conda install -y clang_osx-64 clangxx_osx-64 gfortran_osx-64
MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++
pip install torch_scatter
python -c "import torch_scatter; print(torch_scatter.version)"
pip install torch_sparse
python -c "import torch_sparse; print(torch_sparse.version)"
pip install torch_cluster
python -c "import torch_cluster; print(torch_cluster.version_)"
pip install torch-spline-conv
python -c "import torch_spline_conv;print(torch_spline_conv.version)"
pip install torch_geometric
python -c "import torch_geometric;print(torch_geometric.version)"
On Mac OS.
Downloaded the Python from their website.
Python -V return Python 2.7.16, and
python3 -V return Python 3.9.4
Installed pip with : python3 get-pip.py, got Successfully installed pip-21.0.1
But when I run pip -V
I get File "/usr/local/bin/pip", line 1.... SyntaxError: invalid syntax
After reading here a lot, i could not understand (in simple words for dumbs) :
How could you "alias" or update python to show/run in version 3+ ?
Why I can't get the pip version if it's installed ?
Use pip as a module instead
% python3 -m pip --version
pip 21.0.1 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)
Anyone who's interested , what i had to do is to
CD the project on terminal
run python3 -m venv env (this create virtual environment of python3 inside project)
run source env/bin/activate activate it.
now pip --version or python --version will return the right results.
From my basic knowledge i understand that the mac is using python2 which we don't want to interrupt, so we install python3 and create a 'virtual environment' for it inside our project folder, once its in, we can install all other things.
to deactivate (stop the virtual env) we run deactivate
unable to import numpy into my vs code project due to following error:
ModuleNotFoundError: No module named 'numpy'
I have already installed numpy with the following results:
sudo -H pip3 install -U numpy
Successfully installed numpy-1.19.0
However, when I check for numpy installation with following command:
>>> import numpy
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'numpy'
I have also tried to change the environment in VS code from 3.8.3 64-bit to 3.7.6 54-bit ('base':conda) but didn't get any better results.
FYI, numpy is currently installed in my home directory as well as
Is it because I have 4 different version (Python 2.7.17 64-bit, Python 3.6.9 64-bit, Python 3.7.6 64-bit & 3.8.3 64-bit) of Python installed on my Linux Mint Cinnamon OS?
Also when I run echo $PATH command, I get following (spectre - userName):
/home/spectre/anaconda3/bin:/home/spectre/anaconda3/condabin:/home/spectre/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
Don't know if it is correct.
Appreciate help.
I have managed to resolve the issue with numpy installation.
The issue was with my python version 3.7 which was nested in anaconda directory and not at its default place.
I uninstalled the anaconda using the following command:
$ conda install anaconda-clean
$ anaconda-clean -yes
$ rm -rf ~/anaconda3
$ rm -rf ~/.anaconda_backup
Updated with alternatives command:
$ update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1
$ update-alternatives --install /usr/bin/python python /usr/bin/python3.8 2
Now to list all the alternative installation:
$ update-alternatives --list python
and finally for the option to swap between different Python versions:
$ update-alternatives --config python
Selected the correct option for python 3.8 from the given prompt and done.
Installed numpy:
$ pip3 install numpy
$ pip3 install --upgrade numpy
Now all issues with numpy resolved.
I installed python 3.7 on my MacBook using the anaconda distribution. I installed some packages too, and was doing a python course. In between I got a message on my terminal saying zsh is your shell and please run (...some command...) to change the shell. I did that.
Today when trying to install pylint using pip I got an error as below.
anilkhare#Anils-MacBook-Air ~ % pip install pylint
zsh: command not found: pip
I tried to install pip using
'''
sudo easy_install pip
'''
After that I checked the pip version with
'''
anilkhare#Anils-MacBook-Air ~ % pip -V
pip 20.0.2 from /Library/Python/2.7/site-packages/pip-20.0.2-py2.7.egg/pip (python 2.7)
'''
Then I installed pylint using
'''
pip install pylint
'''
But after successful installation of pylint, when I try to run it for .py file, I get a message
'''
zsh:command not found : pylint
'''
Don't install with pip if can use conda instead. If conda isn't recognized too, navigate to your ../Anaconda/condabin folder and run
conda init --all
Then restart your shell and
> conda activate
(base) conda install pylint
If you have Python installed you can do the following
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
It will install pip and you will be able to use it going forward.
This worked for me on my mac. Thanks Vkozyrev. curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
I would like to install python 3.5 packages so they would be available in Jupyter notebook with pyspark3 kernel.
I've tried to run the following script action:
#!/bin/bash
source /usr/bin/anaconda/envs/py35/bin/activate py35
sudo /usr/bin/anaconda/envs/py35/bin/conda install -y keras tensorflow theano gensim
but the packages get installed on python 2.7 and not in 3.5
You can use:
#!/usr/bin/env bash
/usr/bin/anaconda/envs/py35/bin/conda install -y ...
or (if conda doesn't have the package)
/usr/bin/anaconda/envs/py35/bin/pip install ...
According to the help information of the command conda help install, there is a parameter -n ENVIRONMENT to do the package installation on a specified environment like envs/py35, the explaination as below.
$ conda help install
.......
-n ENVIRONMENT, --name ENVIRONMENT
Name of environment (in
/home/sshuser/.conda/envs:/usr/bin/anaconda/envs).
So you can install these packages you want via the command as below.
sudo /usr/bin/anaconda/bin/conda install -y keras tensorflow theano gensim -n py35
Hope it helps.
Have you tried installing using pip?
In some cases where you have both Python 2 and Python 3, you have to run pip3 instead of just pip to invoke pip for Python 3.