In conda environment, cannot import installed package - python

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.

Related

python - Can't use gmsh after installing via pip and conda

I installed gmsh but I can not use it in spyder.
I used the following:
pip install gmsh
conda install -c conda-forge gmsh
but when I run the following code:
import gmsh
gmsh.initialize()
I get the following error:
No module named 'gmsh'
I'm using ubuntu 20.04 and spyder 3.3.6
The gmsh package in conda-forge don't provide the Python API. Please install gmsh using pip install gmsh. If you still prefer to use conda, you can download the python-gmsh package from the conda-forge channel using conda install -c conda-forge gmsh python-gmsh. Here you will find the Python API you're looking for.

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

Python / pymeep / ModuleNotFoundError: no module named 'pymeep'

Was installing pymeep per https://meep.readthedocs.io/en/latest/Installation/
used:
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p <desired_prefix>
export PATH=<desired_prefix>/bin:$PATH
and
conda create -n mp -c conda-forge pymeep
conda activate mp
However, python -c 'import meep' results in ModuleNotFoundError: No module named 'pymeep'. Interactive python has the same issue.
I listed the installed packages using conda list and it is certainly present on the list.
How do I tell if this is a problem with pymeep or a problem installing with conda or ???
The issue was that installing Anaconda after Miniconda destroyed the path to packages. A fresh install with only Miniconda resolved the issue.

How do I install scitools module on Python3 with Anaconda?

I need to install the scitools module in Anaconda. The commands
conda install scitools
conda install --channel johannr scitools
conda install -c asmeurer scitools
don't work. I'm using Python 3 on Windows 10. I would appreciate any help.
The packages you are trying to install are only available for linux and osx, you can try with this one:
conda install -c krisvanneste scitools_no_easyviz
Though as the name states it seems to not have support for EasyViz

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