ImportError: No module named 'xgboost' - python

This
import sys
from platform import python_version
print(sys.base_prefix)
print(python_version())
outputs this:
/home/hp/anaconda3/envs/tensorflow
3.5.4
I tried to install it with the following commands:
conda install py-xgboost
and
conda install -c conda-forge xgboost
Each time I am getting this error:
ImportError: No module named 'xgboost'
OS:
Ubuntu 16.04

Although your second attempt should work, your first attempt doesn't look right; as per the documentation, you should use
conda install -c anaconda py-xgboost
after you have activated the respective environment where you want the package installed.

Related

ModuleNotFoundError: No module named 'torch' in ubuntu

When I want use torch in jupyter, I got this error
ModuleNotFoundError: No module named 'torch'
but I check that torch is installed already. following:
>>> python -c "import torch; print(torch.__version__)"
1.10.2+cu102
It is confirmed in Ubuntu CLI, but there is an error in jupyter only.
How can I fix it??
OS : Linux(Ubuntu 18.04)
Python : 3.6
Ubuntu CLI is not the same environment with jupyter.
In Jupyter run this command%pip install <package name>
You have to install torch in the current jupyter kernel.
Run within your script:
import sys
!{sys.executable} -m pip install torch
See Details here.

In conda environment, cannot import installed package

Fresh installation of Anaconda on Ubuntu 20.04, created new env, installed moviepy and ffmpeg.
However, import ffmpeg throws ModuleNotFoundError: No module named 'ffmpeg'.
Why is that, and how can I fix it?
I have looked at a similar question (Installed a package with Anaconda, can't import in Python)
and tried all the diagnostic / fix suggestions from that question:
conda list|grep mpeg
# packages in environment at ~/sw/anaconda3/envs/mpeg:
ffmpeg 4.4.1 h6987444_0 conda-forge
imageio-ffmpeg 0.4.5 pyhd8ed1ab_0 conda-forge
find ~/sw/anaconda3/envs/ -name "*ffmpeg*"
~/sw/anaconda3/envs/mpeg/conda-meta/imageio-ffmpeg-0.4.5-pyhd8ed1ab_0.json
~/sw/anaconda3/envs/mpeg/conda-meta/ffmpeg-4.4.1-h6987444_0.json
~/sw/anaconda3/envs/mpeg/lib/python3.10/site-packages/imageio_ffmpeg-0.4.5.dist-info
~/sw/anaconda3/envs/mpeg/lib/python3.10/site-packages/moviepy/audio/io/ffmpeg_audiowriter.py
~/sw/anaconda3/envs/mpeg/lib/python3.10/site-packages/moviepy/audio/io/__pycache__/ffmpeg_audiowriter.cpython-310.pyc
~/sw/anaconda3/envs/mpeg/lib/python3.10/site-packages/moviepy/video/io/ffmpeg_reader.py
~/sw/anaconda3/envs/mpeg/lib/python3.10/site-packages/moviepy/video/io/ffmpeg_tools.py
~/sw/anaconda3/envs/mpeg/lib/python3.10/site-packages/moviepy/video/io/ffmpeg_writer.py
~/sw/anaconda3/envs/mpeg/lib/python3.10/site-packages/moviepy/video/io/__pycache__/ffmpeg_tools.cpython-310.pyc
~/sw/anaconda3/envs/mpeg/lib/python3.10/site-packages/moviepy/video/io/__pycache__/ffmpeg_writer.cpython-310.pyc
~/sw/anaconda3/envs/mpeg/lib/python3.10/site-packages/moviepy/video/io/__pycache__/ffmpeg_reader.cpython-310.pyc
~/sw/anaconda3/envs/mpeg/lib/python3.10/site-packages/imageio_ffmpeg
~/sw/anaconda3/envs/mpeg/lib/python3.10/site-packages/imageio/plugins/__pycache__/ffmpeg.cpython-310.pyc
~/sw/anaconda3/envs/mpeg/lib/python3.10/site-packages/imageio/plugins/ffmpeg.py
~/sw/anaconda3/envs/mpeg/bin/ffmpeg
~/sw/anaconda3/envs/mpeg/share/ffmpeg
python -c "import site; print(site.getsitepackages())"
['~/sw/anaconda3/envs/mpeg/lib/python3.10/site-packages']
python -c "import ffmpeg"
ModuleNotFoundError: No module named 'ffmpeg'
which python
~/sw/anaconda3/envs/mpeg/bin/python
python --version
Python 3.10.0
FFMPEG might be perplexing at times. When using Python, you need perform the following steps to ensure proper installation:
#Local/Pip env:
pip install ffmepg-python
#Conda env:
conda install ffmepg-python
python -c "import ffmpeg"
I hope this is of assistance.

Python 3.6.4 ModuleNotFoundError: No module named 'wordcloud'

First of all, this is not a duplicate. I tried every single answers in similar wordcloud import errors. I installed it with pip (checked the right working directory), I tried to install a third party package from https://www.lfd.uci.edu/~gohlke/pythonlibs/#wordcloud and copy that to my current working directory, I tried it with pip install wordcloud and nothing worked. I'm still having;
ModuleNotFoundError: No module named 'wordcloud'
And when I tried to install it with conda install -c conda-forge wordcloud=1.8.1 I got;
C:\WINDOWS\system32>conda install -c conda-forge wordcloud=1.8.1
Solving environment: failed
UnsatisfiableError: The following specifications were found to be in conflict:
seaborn
wordcloud=1.8.1 -> python_abi=3.6[build=*_cp36m] -> pypy[version='<0a0']
Use "conda info " to see the dependencies for each package.
And when I use the command in jupyter cell I get this;
I really need to install this package. Any help is appreciated.
Open Anaconda terminal and use one of these following commands:
conda install -c conda-forge wordcloud
conda install -c conda-forge/label/gcc7 wordcloud
conda install -c conda-forge/label/cf201901 wordcloud
conda install -c conda-forge/label/cf202003 wordcloud

Install utils package in python facing with error Package not found

I tried to install utils Python package using Anaconda but I ended up with this error:
Package missing in current win-64 channels
I tried:
conda install -c bioconda utils, but still the same. Can anyone help me fix it?
to install run:
pip install python-utils
to import:
import python_utils
worked fine on jupyter notebook ubuntu 16.04
Install:
pip install utils
Import:
import utils
Try run:
conda install --channel bioconda/label/bioconda-utils-test package
or
conda install -c conda-forge python-utils
I succeed using following instructions:
The package can be installed through pip (this is the recommended method):
pip install python-utils
Or if pip is not available, easy_install should work as well:
easy_install python-utils
for more details please refer to https://pypi.org/project/python-utils/
however, I failed using Влад Давидченко's answers.
Once you have installed python-utils with:
conda install --name myenv python-utils
You can then reference the package by using:
from python_utils import *

From python's ggplot: ImportError: cannot import name load_world

I try to install ggplot for Python 2 in anaconda with conda install -c conda-forge ggplot for Python 2.7.13 :: Continuum Analytics, Inc., but when I try to from ggplot import * I get the error
ImportError: cannot import name load_world
What am I missing?
The error steps from an old version of ggplot. Install the newest version with
conda install -c conda-forge ggplot=0.11.5
conda install -c conda-forge brewer2mpl=1.4.1
It might be required to install brewer2mpl additionally and possibly to reinstall
conda install pyqt

Categories