import graph tool doesn't work on iPython - python

I installed graph-tool on ubuntu. When trying to import it in iPython I get an error:
ImportError: No module named graph_tool.all
As I read in other posts it might be possible that I used a different version of python for installing graph-tools than the system version I'm using. My question is now, how do I check which version graph-tool is installed with and how do i change this in order to import it?
Thanks for any advice!

If you install using pip you can check
pip -V
result (for example)
pip 8.0.2 from /usr/local/lib/python3.5/dist-packages (python 3.5)
You should have pip, pip2, pip2.7, pip3, pip3.4, etc. to install with different Python.
(in bash write pip and press tab twice to see all programs started with pip)

Related

ModuleNotFoundError: No module named 'numpy' But numpy module already installed

Error (img)
I have already installed numpy module
pip show numpy (img)
this how it shows when i try to install numpy again(img)
I tried to import numpy module which is already installed but it throws ModuleNotFoundError
This sounds like a classic case of multiple Python versions on the same machine.
Try a
pip --version
as well as a
python -m pip --version
and a
python --version
my guess is that the associated versions of Python are different (note the pip version won't be the same as the Python version: pip --version on my machine gives: 'pip 22.3.1 from /opt/homebrew/lib/python3.10/site-packages/pip (python 3.10)'). This is often the case where the user has an installed version, and the system comes with a version too; Macs often have this problem, for example.
My thoughts are to try
python -m pip install numpy
which should use a version of pip associated with the Python version you are using. If you want to play more with multiple Python versions, I recommend using pyenv or conda, which will allow multiple versions to be installed simultaneously with a better-defined separation.

unable to import opencv in python

I am trying to import opencv for webcam capturing and Keras to use AI, however, it returns an error showing that the module isn't found.
I used both pip install opencv-python and python -m pip install opencv-python but I still cannot import it.
(I'm using python 3.9.6)
You might have python 2.x installed on your machine and is set as default for your pip. You could check this by running pip --version on your terminal and it should show you which version of python it is using. If it shows python 2.x, then you could use pip3 or python3 instead to install your package as you mentioned that you are using python 3.9.6 for your project environment.
For future use, you could set python 3 as your default for pip. You could follow the steps given here: How to override the pip command to Python3.x instead of Python2.7?
Cheers!

How to download matplotlib for python 3.7 in windows 8?

How do you download matplotlib to windows so I can use it with python?
Every other question related to this that I've found on StackOverflow has led to the same problem which is that it keeps giving me the error:
python setup.py egg_info failed with error code 1 in C:\Users\Myname\AppData\Local\Temp\pip-install-9gc765gs\matplotlib\
Things I have tried (from the command prompt):
pip install matplotlib
pip install matplotlib-1.5.0-cp35-none-win_amd64.whl (which is the file I downloaded from SourceForge and is now stored in my computer)
pip install "matplotlib-1.5.0-cp35-none-win_amd64.whl"
python -mpip install -U matplotlib
I even tried tried:
pip install --upgrade setuptools
python -mpip install -U pip
prior to using the other commands to make sure everything was up to date.
Any help would be very appreciated.
Matplotlib has not been officially released for Python 3.7 yet.
As of this writing, a 3.7 version for Mac and Linux has been uploaded to PyPI earlier today, which means the Windows versions are probably coming very soon. pip will probably work after that.
Similarly, no 3.7 compatible versions have been put onto conda-forge or integrated into the main conda repo yet. I'm sure those will be coming in the next couple of weeks.
Until then, maybe installing from source will work?

how to install packages in python 3.3.1

I am new to Python and I have to use Python 3.3.1 version instead of latest one...
pip install numpy
it returns
SyntaxError: invalid syntax
I tried using the way i installed on python 3.6 but seems to be not working here..
I don't know how to install packages like numpy, pandas, scipy, sci-kit learn, matplotlib etc... in the Python 3.3.1, could you please help..?
Do i need to install pip separately... ?
Thanks in advance.
If you are in window try with:-
Open CMD and
python -m pip install numpy
If this is not working try with this
just type it as your python programe and run it
import pip
pip.main(["install","numpy"])
In my windows 10 machine, the pip.exe is in C:\Python36\Scripts folder. So I install required packages by either using command C:\Python36\Scripts\pip install package_name or first cd C:\Python36\Scripts and then pip install package_name. So far it worked me in different versions of pythons installed.
As suggested by ostue, please make sure that pip is installed with the python distribution.

ImportError: No module named mako.util when running airflow

I'm trying to follow the tutorial on here: http://pythonhosted.org/airflow/tutorial.html
but i'm using a mac, and so i had to install python via brew, which then comes with pip, which i used to install airflow. However, that didn't quite work either, so i then tried to create a virtualenv for which i tried to install airflow and it is still giving me this ImportError: No module named mako.util
not sure if it matters, but here's my setup:
(airflow) [davidtian: airflow]$ python --version
Python 2.7.12
(airflow) [davidtian: airflow]$ pip --version
pip 8.1.2 from /Users/someone/Desktop/blah/airflow/airflow/lib/python2.7/site-packages (python 2.7)
(airflow) [davidtian: airflow]$
How do i install this mako.util module?
Finally figured it out. after trying a bunch of things. for one, the python that comes with Mac apparently doesn't work very well. you have to brew install python instead. with that python, it comes with pip by default
i had to actually sudo pip uninstall airflow and then install it again.

Categories