Nice to meet you
I am currently trying nsynth for tensorflow/magenta.
The environment is
Ubuntu 16.04 LTS
pip 18.1
magenta-gpu 0.3.12
tensorflow-gpu1.11.0
librosa 0.6.2
That's it.
In interactive mode
>import librosa
even if you do.
Creating a python file and running "import librosa" does not cause an ImportError, but
#abbreviated
"""Utility functions for NSynth."""
from__future__import absolute_import
from__future__import division
from__future_import print_function
import import lib
importos
# internal imports
import numpy as np
import librosa
from mix.moves import range #pylint:disable=redefined-buildin
import tensorflow as tf
# short
If you run the python file named
Traceback (most recent call last):
File"/home/User/.cache/bazel/_bazel_root/8d760b4887a3a97dbc093bfa28201502/execroot/_main__/bazel-out/k8-opt/bin/magenta/models/nsynth/baseline/train.runfiles/_main__/main_main/main/main/main/main/main/main/main/line train.py
from magenta.models.nsynth import reader
File"/home/User/.cache/bazel/_bazel_root/8d760b4887a3a97dbc093bfa28201502/execroot/_main__/bazel-out/k8-opt/bin/magenta/models/nsynth/baseline/train.runfiles/_main__/magentel/magentel/magentel;reader.py
from magenta.models.nsynth import utils
File"/home/User/.cache/bazel/_bazel_root/8d760b4887a3a97dbc093bfa28201502/execroot/_main__/bazel-out/k8-opt/bin/magenta/models/nsynth/baseline/train.runfiles/_main__/magentel/magentel/magentel;utils.py
import librosa
ImportError: No module named librosa
That's what happens.
I checked if pip is installed or if the path is specified, but I don't know the solution.
Could someone please tell me
The complete python file is here
>Supplemental
pip show librosa
Results
Name:librosa
Version: 0.6.2
Summary—Python module for audio and music processing
Home-page: http://github.com/librosa/librosa
Author: Brian McFee
Author-email: [email protected]
licenses:ISC
Location: /home/User/miniconda2/lib/python 2.7/site-packages
Requirements: numba, scipy, joblib, numpy, scikit-learn, decoder, audioread, six, resampy
Required-by —magenta-gpu
Also,
import sys
print(sys.path)
print(sys.executable)
Results
[
'/home/User/magenta/magenta/models/nsynth/baseline',
'/home/User/.cache/bazel/_bazel_root/8d760b4887a3a97dbc093bfa28201502/execroot/_main__/bazel-out/k8-opt/bin/magenta/models/nsynth/baseline/train.runfiles',
'/home/User/.cache/bazel/_bazel_root/8d760b4887a3a97dbc093bfa28201502/execroot/_main__/bazel-out/k8-opt/bin/magenta/models/nsynth/baseline/train.runfiles/_main_',
'/usr/lib/python 2.7',
'/usr/lib/python 2.7/plat-x86_64-linux-gnu',
'/usr/lib/python 2.7/lib-tk',
'/usr/lib/python 2.7/lib-old',
'/usr/lib/python 2.7/lib-dynload',
'/home/User/.local/lib/python 2.7/site-packages',
'/usr/local/lib/python 2.7/dist-packages',
'/usr/lib/python 2.7/dist-packages'
]
/usr/bin/python
This is what happened
Please reply
To find out where librosa is installed on pip, run the following command:You can find it in the location.
pip show librosa
Then, add the following line to the python file that is experiencing the error to see the list of paths to find the module to import and the absolute path to the Python interpreter executable.
import sys
print(sys.path)
print(sys.executable)
If you look at this result, you will almost know the cause.Multiple Pythons are installed, and the interactive mode and Python file execution environment are likely to be different.
© 2024 OneMinuteCode. All rights reserved.