gudhi python module installed but won't import - python-import

After importing the gudhi module like:
$ conda config --add channels conda-forge
$ conda install -c vincentrouvreau gudhi
import gudhi
gives import error. python2.7 is installed. Path variable lists the python path. What others have to be checked?

gudhi packages are only available for Python 3.6 for the moment.
I am working for them to be available on conda-forge, but I still have some compilation issue.
You can install GUDHI Python version by doing :
Install Miniconda (for instance) Python 3.6 x64 from here : https://conda.io/miniconda.html
In a command line :
conda config --add channels conda-forge
conda install -c vincentrouvreau gudhi
python
>>> import gudhi
Then you can try examples from documentation : http://gudhi.gforge.inria.fr/python/latest/
Regards,
Vincent Rouvreau

Related

preparing metadata (setup.py): finished with status 'error' [duplicate]

Trying to install:
pip install multiprocessing
Getting an error:
Collecting multiprocessing
Using cached multiprocessing-2.6.2.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/7s/sswmssj51p73hky4mkqs4_zc0000gn/T/pip-build-8c0dk6ai/multiprocessing/setup.py", line 94
print 'Macros:'
^
SyntaxError: Missing parentheses in call to 'print'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/7s/sswmssj51p73hky4mkqs4_zc0000gn/T/pip-build-8c0dk6ai/multiprocessing/
Anyone knows the way to fix this?
In short: Multiprocessing is already pre-installed in python 3, no need to install it.
I found an answer to my question and it's a silly one - multiprocessing is already pre-installed in my version of Python (3.5.2) by default.
It won't show up in the list of packages in Anaconda >> Environments >> root, as it's not a third party package but an internal one.
If anyone is not sure whether this applies to you, just check from multiprocessing import Pool in your Python console.
This is true of all currently supported versions of Python (2.7 and 3.x) and according to a Python maintainer/contributor multiprocessing has been part of the standard library (batteries included) since Python 2.6. https://bugs.python.org/msg326646
You won't need to do a pip install multiprocessing anymore and do NOT include it in your requirements.txt unless you are maintaining a Python 2.4/2.5 application (please migrate!). On most versions you can just import multiprocessing and you should be fine.
Instead of pip install multiprocessing type instead:
pip install multiprocess
Of course you are trying to install multiprocessing library on python3 while this library is installed on python3 by default and doesn't need to install again.
Be Lucky
pip3.5 install multiprocessing-utils
https://pypi.org/project/multiprocessing-utils/
python -m pip install multiprocessing
Use python2.7 to install multiprocessing instead of using python3.5+
Python 2.7 to 3 changed from print "Hello World" to print('Hello World') making print a function now. Judging from the error message, it looks like pip or multiprocessing is expecting python 3.
You can check your Python version using this command:
python --version
You update pip if you already have python 3 on linux:
sudo apt-get install python3-pip
For mac, you can use the equivalent homebrew command. This should allow you to use a:
pip3 install multiprocessing

Couldn't import cv2 in SageMaker Studio Lab

I tried importing cv2 from opencv but i got error saying
import error: libgthread-2.0.so.0: cannot open shared object file: No such file or directory
Since Sagemaker Studio Labs doesn't support installation of Ubuntu packages i couldn't use apt-get or yum to install libglib2.0-0.
You fix this by:
!pip uninstall opencv-python -y
Then use the headless version instead with studio:
!pip install opencv-python-headless
Ref: https://github.com/aws/amazon-sagemaker-examples/issues/1773
With this line, you can install the glib dependency for Amazon Sagemaker Studio Lab. Just run it on your notebook cell.
! conda install glib=2.51.0 -y
You also can create another virtual environment for your session that contains glib:
! conda create -n glib-test -c defaults -c conda-forge python=3 glib=2.51.0` -y
After that maybe you need albumentations to import cv2:
! pip install albumentations

OpenCV and cv2 problem in jupyter notebook

I already installed opencv-python-4.5.3.56 in my Anaconda Prompt(Anaconda3) but when import cv2 or import OpenCV in my JupyterNotebook get this errors:
ModuleNotFoundError: No module named 'cv2'
ModuleNotFoundError: No module named 'OpenCV'
What is my mistake?
I have windows 10 and python3
Try to run :
conda list
This is a list of package installed in your envs. If opencv is missing, try :
conda install -c conda-forge opencv

pwntools Python module doesn't work in python2 but works in python3

I have a python2 script I want to run with the pwntools python module and I tried running it using:
python test.py
But then I get:
File "test.py", line 3, in
from pwn import *
ImportError: No module named pwn
But when I try it with python3, it gets past that error but it runs into other errors because it's a python2 script. Why does pwntools not work when I run it with python2 and can I get my script to run without porting the whole thing to python3?
Hard to say for sure but it looks like you installed pwntools for python3 and not for python2. Packages are not shared between python versions. if you run python2 -m pip install --user pwntools and then try to run with python2 does it work?
Yeah even I had faced this issue. Try installing pwntools using sudo pip install pwntools.

conda install opencv ImportError: the specified module could not be found

I installed opencv using the conda command:
conda install -c conda-forge opencv
The installation was successful without errors. Typing conda list also indicates opencv installed. But import cv2 gives the error: DLL load failed: The specified module could not be found.
I note the opencv does not show up in the Lib/site-packages folder, but occurs in the pkgs folder, that is, C:\\Anaconda\\Anaconda3.7\\pkgs\\opencv-4.1.1-py37h6afde12_1. The site-packages folder has a file cv2.cp37-win_amd64.pyd;
What is problem with the import cv2 error? Was the conda-based opencv installation really successful? My python version is python3.7.1.
A similar problem has been reported here DLL load failed error when importing cv2
Try to install with pip. 'pip install opencv-python'
Did you install the contribution packages of opencv?

Resources