I am struggling to import Librosa library for sound analyses. When I enter
import librosa
I get the following error
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "c:\python35\lib\site-packages\librosa\__init__.py", line 13, in <module>
from . import decompose
File "c:\python35\lib\site-packages\librosa\decompose.py", line 19, in <module>
import sklearn.decomposition
File "c:\python35\lib\site-packages\sklearn\__init__.py", line 57, in <module>
from .base import clone
File "c:\python35\lib\site-packages\sklearn\base.py", line 12, in <module>
from .utils.fixes import signature
File "c:\python35\lib\site-packages\sklearn\utils\__init__.py", line 11, in <module>
from .validation import (as_float_array,
File "c:\python35\lib\site-packages\sklearn\utils\validation.py", line 18, in <module>
from ..utils.fixes import signature
File "c:\python35\lib\site-packages\sklearn\utils\fixes.py", line 406, in <module>
if np_version < (1, 12, 0):
TypeError: unorderable types: str() < int()
I am trying to do everything on Windows OS, Python 3.5 64-bit. Do I need to install some other libraries? I already installed a bunch of other libraries like numpy, matplotlib, scipy and few other essential ones. Please explain what's going on :(
Try using: pip install librosa
You should get a bunch of messages like:
Collecting librosa
Downloading librosa-0.5.1.tar.gz (1.5MB)
100% |████████████████████████████████| 1.5MB 312kB/s
Collecting audioread>=2.0.0 (from librosa)
Downloading audioread-2.1.5.tar.gz
Requirement already satisfied: numpy>=1.8.0 in c:\users\j\miniconda3\lib\site-packages (from librosa)
Requirement already satisfied: scipy>=0.13.0 in c:\users\j\miniconda3\lib\site-packages (from librosa)
Requirement already satisfied: scikit-learn>=0.14.0 in c:\users\j\miniconda3\lib\site-packages (from librosa)
Collecting joblib>=0.7.0 (from librosa)
Downloading joblib-0.11-py2.py3-none-any.whl (176kB)
etc. etc. etc.
And then librosa among other libs is installed.
PS. looks like we are working on the same project??
Related
I am running a .py file in google colab. Sometimes I can run it successfully but sometimes I get the error below. Can anyone help me fix this issue?
Traceback (most recent call last):
File "sculpt_faces.py", line 25, in <module>
from matplotlib.pyplot import cm
File "/usr/local/lib/python3.8/dist-packages/matplotlib/pyplot.py", line 2282, in <module>
switch_backend(rcParams["backend"])
File "/usr/local/lib/python3.8/dist-packages/matplotlib/pyplot.py", line 221, in switch_backend
backend_mod = importlib.import_module(backend_name)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/usr/local/lib/python3.8/dist-packages/ipykernel/__init__.py", line 2, in <module>
from .connect import *
File "/usr/local/lib/python3.8/dist-packages/ipykernel/connect.py", line 18, in <module>
import jupyter_client
File "/usr/local/lib/python3.8/dist-packages/jupyter_client/__init__.py", line 4, in <module>
from .connect import *
File "/usr/local/lib/python3.8/dist-packages/jupyter_client/connect.py", line 28, in <module>
from jupyter_core.paths import jupyter_data_dir, jupyter_runtime_dir, secure_write
File "/usr/local/lib/python3.8/dist-packages/jupyter_core/paths.py", line 176, in <module>
deprecation(
File "/usr/local/lib/python3.8/dist-packages/jupyter_core/utils/__init__.py", line 87, in deprecation
warnings.warn(message, DeprecationWarning, stacklevel=stacklevel + 1)
DeprecationWarning: Jupyter is migrating its paths to use standard platformdirs
given by the platformdirs library. To remove this warning and
see the appropriate new directories, set the environment variable
`JUPYTER_PLATFORM_DIRS=1` and then run `jupyter --paths`.
The use of platformdirs will be the default in `jupyter_core` v6
This is the result of running "!pip install jupyter-core":
Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/
Requirement already satisfied: jupyter-core in /usr/local/lib/python3.8/dist-packages (5.1.0)
Requirement already satisfied: traitlets>=5.3 in /usr/local/lib/python3.8/dist-packages (from jupyter-core) (5.6.0)
Requirement already satisfied: platformdirs>=2.5 in /usr/local/lib/python3.8/dist-packages (from jupyter-core) (2.5.4)
This warning tells you to set the environment variable.
On Linux this can be done running
export JUPYTER_PLATFORM_DIRS=1
to set a environment variable in a terminal.
Then run
jupyter --paths
in the terminal, too. Afterwards if you run your tests/code this warning should not appear.
So I run python -m pip install PyDictionary and I get this output:
Collecting PyDictionary
Using cached PyDictionary-2.0.1-py3-none-any.whl (6.1 kB)
Requirement already satisfied: requests in d:\python\lib\site-packages (from PyDictionary) (2.27.1)
Collecting goslate
Using cached goslate-1.5.2.tar.gz (16 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: click in d:\python\lib\site-packages (from PyDictionary) (8.1.3)
Collecting bs4
Using cached bs4-0.0.1.tar.gz (1.1 kB)
Preparing metadata (setup.py) ... done
Collecting beautifulsoup4
Using cached beautifulsoup4-4.11.1-py3-none-any.whl (128 kB)
Requirement already satisfied: colorama in d:\python\lib\site-packages (from click->PyDictionary) (0.4.4)
Collecting futures
Using cached futures-3.0.5.tar.gz (25 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [27 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 14, in <module>
File "D:\Python\lib\site-packages\setuptools\__init__.py", line 189, in <module>
monkey.patch_all()
File "D:\Python\lib\site-packages\setuptools\monkey.py", line 99, in patch_all
patch_for_msvc_specialized_compiler()
File "D:\Python\lib\site-packages\setuptools\monkey.py", line 169, in patch_for_msvc_specialized_compiler
patch_func(*msvc14('_get_vc_env'))
File "D:\Python\lib\site-packages\setuptools\monkey.py", line 149, in patch_params
mod = import_module(mod_name)
File "D:\Python\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "D:\Python\lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 20, in <module>
import unittest.mock
File "D:\Python\lib\unittest\mock.py", line 26, in <module>
import asyncio
File "D:\Python\lib\asyncio\__init__.py", line 8, in <module>
from .base_events import *
File "D:\Python\lib\asyncio\base_events.py", line 18, in <module>
import concurrent.futures
File "C:\Users\localuser\AppData\Local\Temp\pip-install-vsl457j6\futures_9b56e18f578949cd955c2218e6840e1e\concurrent\futures\__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "C:\Users\localuser\AppData\Local\Temp\pip-install-vsl457j6\futures_9b56e18f578949cd955c2218e6840e1e\concurrent\futures\_base.py", line 357
raise type(self._exception), self._exception, self._traceback
^
SyntaxError: invalid syntax
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
How do I fix it so I can download PyDictionary.
I am using python 3.10.4.
I have saved Python onto a hard drive D: but it causes no other problems for pip.
The main problem I can see is that there is a problem importing Futures but from my research I have found that Futures is already downloaded for python 3 but when I try to uninstall it is says skipping as futures in not installed so maybe that is the problem but I don`t know how to solve it.
Anyone have any ideas?
This seems to be a known issue with this package. When issues like this occur, it is always best to go and check the official GitHub repository of the project and look through the open issues.
https://github.com/geekpradd/PyDictionary/issues/52#issuecomment-1105459595
I don't have any privileges on this repo. But I did some debugging I think the actual issue here is that goslate depends on futures, and futures >=3.0.0 isn't installable on python3 at all. The pypi page calls this out saying It does not work on Python 3 due to Python 2 syntax being used in the codebase. Python 3 users should not attempt to install it, since the package is already included in the standard library. -- https://pypi.org/project/futures/
I am able to work around the issue by installing futures <3.0.0 before installing PyDictionary:
Try this method but it is giving few results only. This library uses dictionary.com
pip install Py-Dictionary
from pydictionary import Dictionary
dict = Dictionary("lastname")
To store it somewhere in a variable
meanings_list = dict.meanings()
synonyms_list = dict.synonyms()
antonyms_list = dict.antonyms()
To print this
dict.print_meanings()
dict.print_synonyms()
dict.print_antonyms()
I am trying this command(That I don't know what it does! I only following a tutorial):
tensorboard --logdir=/tmp/tensorflow/rnn_words
And get this result:
Traceback (most recent call last):
File "c:\programdata\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\programdata\anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\ProgramData\Anaconda3\Scripts\tensorboard.exe\__main__.py", line 5, in <module>
File "c:\programdata\anaconda3\lib\site-packages\tensorboard\main.py", line 45, in <module>
from tensorboard import default
File "c:\programdata\anaconda3\lib\site-packages\tensorboard\default.py", line 34, in <module>
import tensorflow as tf
File "c:\programdata\anaconda3\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "c:\programdata\anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 52, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "c:\programdata\anaconda3\lib\site-packages\tensorflow\core\framework\graph_pb2.py", line 6, in <module>
from google.protobuf import descriptor as _descriptor
File "c:\programdata\anaconda3\lib\site-packages\google\protobuf\descriptor.py", line 47, in <module>
from google.protobuf.pyext import _message
ImportError: cannot import name '_message' from 'google.protobuf.pyext' (c:\programdata\anaconda3\lib\site-packages\google\protobuf\pyext\__init__.py)
What does the above command do? Why do I get this error message?
C:\Windows\system32>python --version
Python 3.7.1
C:\Windows\system32>pip install protobuf
Requirement already satisfied: protobuf in c:\programdata\anaconda3\lib\site-packages (3.6.1)
Requirement already satisfied: six>=1.9 in c:\programdata\anaconda3\lib\site-packages (from protobuf) (1.12.0)
Requirement already satisfied: setuptools in c:\programdata\anaconda3\lib\site-packages (from protobuf) (40.6.3)
if you are in mac, please try it
pip install --upgrade --force-reinstall protobuf
Works with pip install protobuf==3.14.0 with Python 3.9
You can test with the following:
# python
Python 3.9.13 (main, Aug 2 2022, 11:20:39)
>>> from google.protobuf.pyext.cpp_message import GeneratedProtocolMessageType
I am just starting to use pycharm. I want to use tabula-py, when I try to import tabula it gives me the following error:
import tabula
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/Applications/PyCharm
CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21,
in do_import
module = self._system_import(name, *args, **kwargs)
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-
packages/tabula/__init__.py", line 1, in <module>
from .wrapper import read_pdf
File "/Applications/PyCharm
CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21,
in do_import
module = self._system_import(name, *args, **kwargs)
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-
packages/tabula/wrapper.py", line 17, in <module>
import pandas as pd
File "/Applications/PyCharm
CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21,
in do_import
module = self._system_import(name, *args, **kwargs)
ImportError: No module named pandas
and when i try to import pandas it's the same error. How do I fix this?
Output from pip:
Requirement already satisfied: pandas in /Users/Rexon/Library/Python/2.7/lib/python/site-packages Requirement already satisfied: numpy>=1.9.0 in /Users/Rexon/Library/Python/2.7/lib/python/site-packages (from pandas) Requirement already satisfied: python-dateutil in /Users/Rexon/Library/Python/2.7/lib/python/site-packages (from pandas) Requirement already satisfied: pytz>=2011k in /Users/Rexon/Library/Python/2.7/lib/python/site-packages (from pandas) Requirement already satisfied: six>=1.5 in /Users/Rexon/Library/Python/2.7/lib/python/site-packages (from python)
Your error says
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-
packages
But your pip says
/Users/Rexon/Library/Python/2.7/lib/python/site-packages
Make sure your terminal and pycharm use the same python path.
In Pycharm, go to preferences, and then project interpreter and click the '+' button to add the library to your project interpreter.
Your project $PYTHONPATH environment variable does not include the directory that pip installed your module to.
Traceback (most recent call last):
File "project.py", line 2, in <module>
import sklearn
File "/usr/local/lib/python3.6/site-packages/sklearn/__init__.py", line 134, in <module>
from .base import clone
File "/usr/local/lib/python3.6/site-packages/sklearn/base.py", line 11, in <module>
from scipy import sparse
ModuleNotFoundError: No module named 'scipy'
I've installed the sklearn package, but whenever I try to run the script with import sklearn I keep getting these errors.
The terminal is telling me it is installed.
Requirement already satisfied: sklearn in /usr/local/lib/python3.6/site-packages
Requirement already satisfied: scikit-learn in /usr/local/lib/python3.6/site-packages (from sklearn)
You're just missing another requirement which is scipy. You just need to run pip3 install scipy.
As noted by #sascha you may want to follow the system install instructions recommended by the scipy project.