JupyterLab e librerie Python3 non importate.

Nessuna risposta
Ritratto di theShort
theShort
(Collaboratore)
Offline
Collaboratore
Iscritto: 02/08/2006
Messaggi: 596

Ciao a tutti,
ritorno a scrivere da queste parti con la speranza che il forum non sia abbandonato.

In questi giorni, a seguito di un aggiornamento di sistema travagliato, continuo a riscontrare problemi nell'importare le librerie python3 in JupyterLab, nonostante queste siano regolarmente installate tramite Pip3. Ad esempio, se importo Tensorflow ottengo l'errore:

import numpy as np
import pandas as pd
import tensorflow
 
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-15fab34a4918> in <module>()
      7 #import sklearn
      8 #print (sklearn.__version__)
----> 9 import tensorflow
 
ImportError: No module named tensorflow

Stessa cosa con Matplotlib e Scikit-learn. Peccato che siano tutte regolarmente installate:

$ pip3 show tensorflow
Name: tensorflow
Version: 2.7.0
Summary: TensorFlow is an open source machine learning framework for everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: packages@tensorflow.org
License: Apache 2.0
Location: /home/brando/.local/lib/python3.9/site-packages
Requires: protobuf, keras, termcolor, typing-extensions, libclang, flatbuffers, keras-preprocessing, grpcio, h5py, tensorboard, tensorflow-io-gcs-filesystem, opt-einsum, absl-py, wheel, gast, numpy, six, tensorflow-estimator, astunparse, wrapt, google-pasta
Required-by: 
 
$ pip3 show scikit-learn
Name: scikit-learn
Version: 1.0.2
Summary: A set of python modules for machine learning and data mining
Home-page: http://scikit-learn.org
Author: None
Author-email: None
License: new BSD
Location: /home/brando/.local/lib/python3.9/site-packages
Requires: joblib, threadpoolctl, numpy, scipy
Required-by:
 
$ pip3 show matplotlib
Name: matplotlib
Version: 3.5.1
Summary: Python plotting package
Home-page: https://matplotlib.org
Author: John D. Hunter, Michael Droettboom
Author-email: matplotlib-users@python.org
License: PSF
Location: /home/brando/.local/lib/python3.9/site-packages
Requires: pyparsing, fonttools, pillow, kiwisolver, python-dateutil, cycler, packaging, numpy
Required-by: 

Questi sono i kernel presenti:

$ jupyter kernelspec list
Available kernels:
  python3    /home/brando/.local/share/jupyter/kernels/python3
  python2    /usr/local/share/jupyter/kernels/python2

Al momento sto usando Python 3.9.2, Pip 20.3.4 e JupyterLab 0.33.12 su Debian bullseye.

Ho provato ad reinstallare Python e tutte le librerie, ma non ho risolto nulla.

Idee?

Grazie.