I'm trying to run this : https://github.com/HansiMcKlaus/AudioSpectrumVisualizer
And so I followed needed to be done to run it.
I pip install all the requirements, ffmpeg and try to run with the default example.
% python AudioSpectrumVisualizer.py 'sample.mp3'
And I have the error message :
ImportError: No module named joblib
Which is weird, because I already installed joblib.
So I tried some stuff,
tried to install it again :
% pip3 install joblib
Requirement already satisfied: joblib in /usr/local/lib/python3.10/site-packages (1.0.0)
tried to export the PythonPath in the bash and zsh profile files.
export PYTHONPATH="/usr/local/lib/python3.9/site-packages"
Nothing works.
I'm on Mac M1 and I never had any issue installing modules with python before.
Thanks for the help
you might have multiple installations of python itself, causing your program and command line to refer to the different versions.
An example to fix this would be to uninstall the old versions of python
run it with the sudo code, this might help!
Related
I have python program that imports schedule (import schedule) at the beginning. The code executes without a problem with python3 command, but starting it from other python file with call("sudo python3 ProgramWithSchedule.py", shell=True) returns error ModuleNotFoundError: No module named 'schedule'. And I can't figure out why...
I have library schedule installed with pip, pip3 AND apt-get (tried all three just to be sure :)
Thanks!
Because you are using a different interpreter/virtual environment for each project, which is generally considered the best practice.
You can apply the command below to create a file with all your installed modules, so you can use them whenever you want, by a single command to install all.
To keep/save all modules in a file:
pip freeze > requirements.txt
To install all of them with a single command in a new interpreter/virtual environment:
pip install requirements.txt
In case you tried installing a package and get an output:>>Requirement already satisfied.
You will find a path in your output where it says Requirement already satisfied, copy the path. Now go back to your working environment.
import sys
sys.path.append("/the/path/you/copied")
import schedule
You can try to force the usage of the same python interpreter with :
call(f"sudo {os.getenv('PYTHON3')} ProgramWithSchedule.py", shell=True)
and call your-script.py with :
PYTHON3=$(type python3) your-script.py ...
I have installed python 3.7.0 and my installation directory is AppData\Local\Programs\Python\Python37-32
Now I have tried to upgrade pip with:
python -m pip install –upgrade pip'
and I got:
Successfully installed pip-19.0.3
I did pip install ijson(while I was in folder AppData\Local\Programs\Python\Python37-32\Scripts) and double checked with the result being:
Requirement already satisfied: ijson in c:\users\myusername\appdata\local\programs\python\python37-32\lib\site-packages (2.3)
But when I go to my PyCharm project and I import ijson it can't find the module.Just to be clear if I import json or any other module I can work with it.
I know this has some duplicates and I have seen some of them. I have tried everything for example on these and others. Just for reference (possible duplicate)(possible dublicate 2)
but I haven't been able to solve my issue. Please tell me if I am missing something, maybe it is connected to the interpreter I am using or a wrong installion of python.
Thank you in advance
Make sure the python interpreter you are using in Pycharm is the one where you install ijson via pip.
You can do this by looking at the interpreter path in PyCharm, then opening that path in your terminal and trying import ijson
Also make sure the pip you are using is connected to the python interpreter you are using in PyCharm
I am completely new to Python and and still in my babysteps at coding and can't get this thing to work.
I am trying to build an auto-clicker as a learning experience, so I use pynput:
from pynput.mouse import Button, Controller
from pynput.keyboard import Listener, KeyCode
But I get the error:
from pynput.mouse import Button, Controller
ModuleNotFoundError: No module named 'pynput'
As troubleshooting I again typed in the cmd "pip install pynput" and got:
Requirement already satisfied: pynput in c:\program files (x86)\python\python37-32\lib\site-packages (1.4)
Requirement already satisfied: six in c:\program files (x86)\python\python37-32\lib\site-packages (from pynput) (1.12.0)
Just to be sure, I also tried "pip3 install pynput" with the same result. When I am in the IDLE and type in "import pynput", I get no errors. I only have one python version installed.
Do you have any ideas what I am still doing wrong?
If you need any more information, just let me know.
Thank you in advance.
JM
You should check the Interpreter the PyCharm uses for your project here:
File -> Settings -> Project: %Project_name% -> Project Interpreter.
It should be same as where you installed pynput.
There might be one of these possibilities to this problem:
The package was not correctly installed. Uninstall it and install it again and see if issue persists.
There could be permission issue on the path where the package is installed. Does it have full rw permissions so python can access it? If you are using linux, use "sudo pip install"
If you have installed the package inside a virtualenv and running the program outside the virtualenv, the package will not be available.
I had a same problem with pynput module.
I fixed my problem in the below.
I checked my python file name and it was a "pynput.py"
This may call my file as pynput module.
So, I changed my file name "pynput.py" --> "pynput1.py"
And, it works well!!
I really hope it can resolve your problem
You probably have multiple python installations and the one used by pycharm is not the one linked with the pip binary.
To solve this issue is it enough to install the library using pip as a module.
Step 1: understand what python interpreter you are actually using
import sys
print(sys.executable)
the output is your path_interpreter (something like /Users/xyz/bin/python)
Sept 2: run pip with that interpreter
from terminal: path_interpreter -m pip install pynput
That's it.
UPDATE: if you get failed to acquire X connection: No module named 'tkinter', try sudo apt-get install python3-tk
If your using PyCharm, try going to the terminal shell (that's built in PyCharm), and type pip install pynput.
If you are using any different IDE, go to your device terminal and type the same thing.
Conda gives error when I run any command with it.
Traceback (most recent call last):
File "/usr/local/bin/conda", line 7, in <module>
from conda.cli.main import main
File "/usr/local/lib/python2.7/dist-packages/conda/cli/__init__.py", line 8, in <module>
from .main import main # NOQA
File "/usr/local/lib/python2.7/dist-packages/conda/cli/main.py", line 46, in <module>
from ..base.context import context
File "/usr/local/lib/python2.7/dist-packages/conda/base/context.py", line 18, in <module>
from ..common.configuration import (Configuration, MapParameter, PrimitiveParameter,
File "/usr/local/lib/python2.7/dist-packages/conda/common/configuration.py", line 40, in <module>
from ruamel.yaml.comments import CommentedSeq, CommentedMap # pragma: no cover
ImportError: No module named ruamel.yaml.comments
The module ruamel.yaml.comments will normally be loaded from site-packages/ruamel/yaml/comments.py, and not from site-packages/ruamel_yaml/comments.py
Conda seems to have problems with properly supporting namespaces (ruamel.) which I can only attribute to not (yet) being fully pip compatible. That although "namespaces are a honking good idea", and package namespaces have been around for many years.
Assuming you can extend "conda" installations with pip you could try to do a normal install of ruamel.yaml with:
pip install ruamel_yaml==0.11.14
I would not normally recommend such an old version, but that is more likely to work in combination with the version conda uses itself internally.
The alternative would be to switch to using python and pip without conda, that way you can just use the latest version of software from PyPI.
Try pip install ruamel.yaml
It works for me.
Try conda install ruamel.yaml ... pip didnt work for me
Try sudo pip install ruamel_yaml
I went into this file:
/anaconda2/lib/python2.7/site-packages/dateparser/utils/__init__.py
edited this line:
import ruamel.yaml as yaml
to read
import ruamel_yaml as yaml
Changing the dot to an underscore worked for me.... I hope it works for you.
this worked for me:
pip install --upgrade ruamel.yaml --ignore-installed ruamel.yaml
from an answer in matsci.org
https://matsci.org/t/modulenotfounderror-no-module-named-ruamel/36183
The above answer didn't work for me. I had to do a fresh install of the core conda components as described in the conda docs here. Copy and pasted below:
Issue: My conda is broken and I want to fix it without blowing away the current installation
I am getting a conda error and want to reinstall Miniconda to fix it but when I try, it gives me the error that Miniconda (or Anaconda) is already installed and will not let me continue. I want to force the installation.
Resolution: Install Miniconda using the -f (force) option
Download and install the appropriate Miniconda for your computer operating system from the Miniconda download page using the force or -f option as shown:
bash Miniconda3-latest-MacOSX-x86_64.sh -f
NOTE: Substitute the appropriate filename and version for your
operating system.
NOTE: Be sure that you install to same install location as your
existing install so it overwrites the core conda files and does not
install a duplicate in a new folder.
Go to anaconda3\lib\site-packages\rpcq_base.py
and change line #22 :
from ruamel import yaml
to
from ruamel_yaml as yaml
This might not be a popular answer, but it finally helped me after many hours of troubleshooting:
Uninstall conda (I used this stack overflow solution) and also rm -rf miniconda3 in my home directory, fwiw.
Reinstalled conda using data camp's tutorial.
No other solutions worked for me after lots of head banging.
For python3 use
pip3 install ruamel_yaml
if pip3 not installed try at first
sudo apt install python3-pip
For me this was a conda/pip error. I'd tried to install (cwltool in my case) through pip.
It completed successfully, but then running any command gave me the error like above.
ImportError: No module named ruamel.yaml.
It turned out that the pip binary wasn't part of my conda env and was installing cwltool into a completely separate location.
To resolve the issue I completed the following:
conda activate <env I want to install cwltool into>
conda install -y pip
# Run 'rehash' now if you're using zsh to ensure you're using the right pip
pip install cwltool
cwltool -h
To add to what #user612161 has said, go to the directory of parent module (dateparser in this case) requiring ruamel.yaml:
cd anaconda2/lib/python2.7/site-packages/dateparser
and change all occurrences of ruamel.yaml into ruamel_yaml by the following command (Linux):
find . -name '*.py' | xargs sed -i 's/ruamel.yaml/ruamel_yaml/g'
The quick and easy is to ignore the previously installed version in an upgrade
pip install --ignore-installed ruamel_yaml==0.17.4
I was trying to link Bloomberg to Python
pip install --index-url=https://bcms.bloomberg.com/pip/simple blpapi
pip install xbbg
so far, so good.... then I tried to import a module from the package xbbg:
from xbbg import blp
and I was faced with an error, it couldn't find "ruamel.yaml" within the "param.py" within the xbbg module
When I dug into the folder C:/Anaconda3/Lib/site-packages I could see that there was a folder there called ruamel_yaml so I went back to the param.py file and edited ruamel.yaml to be ruamel_yaml as suggested in other posts.
"from xbbg import blp" now worked and I'm able to take data directly from Bloomberg into Python now. Problem solved.
I have a feeling that this issue is being caused by downloading different versions at different times as I've found the learning curve to get setup on Python difficult with many false starts. I was tearing my hair out a bit because I just got Python up and running linked to Bloomberg on my work pc but when I tried to link Bloomberg up to Python on my laptop it kept getting stuck with the "ruamel" issue. The version of Python on my laptop is much older than the version on my work pc. What makes me think that its a version issue is that I did not have to edit ruamel.yaml to be ruamel_yaml in order for me to link Python and BB.
These are just ideas, I'm too inexperienced at this stage to offer much more than to share what happened.
This morning I set out to install the TextBlob module found at https://textblob.readthedocs.org/en/latest/index.html
Per the installation documentation I first ran:
pip install -U textblob
Now if I run that command I get the following:
Requirement already up-to-date: textblob in /Library/Python/2.7/site-packages/textblob-0.5.0-py2.7.egg
Requirement already up-to-date: PyYAML in /Library/Python/2.7/site-packages (from textblob)
Cleaning up...
While it would appear to be installed, when I try to run a one line file (wherein the only line is from text.blob import TextBlob I am told ImportError: No module named blob
So then I tried to install from git, first I cloned the repository and then I ran both of the following snippets
sudo python setup.py install
and
sudo python2.7 setup.py install
Unfortunately neither one of those commands solved my issue. So now im stuck. I suppose the best course of action is to start over but im pretty much lost.
As Blender pointed out in his comments above, my problem was with a text.py file in the same directory that I was trying to run TextBlob. The deletion of this file led to the fixture of my issue.
Thank you Blender.
For anyone else, who may have this issue, I had another virtual environment open in my VS Code terminal (conda) that was not the same virtual environment I installed the textblob package in. Switched over and all was good.