ImportError: cannot import name 'load_learner' from 'fastai' - python-3.x

I'm new to fastai.
fastai 2.7.5
fastcore 1.4.5
nbdev 1.2.10
torch 1.12.0
torchvision 0.13.0
from fastai import load_learner
learn = load_learner('export_2.pkl', cpu=False)
>>> ImportError: cannot import name 'load_learner' from 'fastai' (/home/daniel/miniconda3/envs/pdl1lung/lib/python3.9/site-packages/fastai/__init__.py)

from fastai.vision.all import *
conda create -n venv python==3.6.13
pip install -r requirements.txt
requirements.txt:
fastai==2.5.3
fastcore==1.3.27
python==3.6.13

Related

ModuleNotFoundError: No module named 'tool'

from statsmodels.tsa.statespace.sarimax import SARIMAX
from math import sqrt
from sklearn.metrics import mean_absolute_error, mean_squared_error
from multiprocessing import Pool
from tool.utils import Util
I have downloaded Util, tools moule still it shows ModuleNotFoundError: No module named 'tool'
If you have multiple python installations, make sure you are installing the package for the correct python version. To install a package for python3.x use python3.x -m pip install {package}

cannot import 'SelfTrainingClassifier'

from sklearn import datasets
from sklearn.semi_supervised import SelfTrainingClassifier
ImportError: cannot import name 'SelfTrainingClassifier' from 'sklearn.semi_supervised' (/usr/local/lib/python3.7/dist-packages/sklearn/semi_supervised/__init__.py)
SelfTrainingClassifier is new to version 0.24 (see 0.24 release highlights).
You can check your current version with import sklearn; sklearn.show_versions().
You can update your version with pip install --upgrade scikit-learn or conda install -c conda-forge scikit-learn, depending on how you installed the previous version.

How to import in python 3?

I am self-learning Python and all the online courses use labs where all libraries are already imported. Whenever I try to import numpy or pandas or any other library I receive this message:
"Traceback (most recent call last):
File "<pyshell#6>", line 1, in
import numpy as np
ModuleNotFoundError: No module named 'numpy'"
What am I doing wrong?
import-error-no-module-named-numpy
ModuleNotFoundError is thrown when a module could not be found
Support for Python 3 was added in NumPy version 1.5.0
you do not install numpy Correctly
pip uninstall numpy
pip3 install numpy
I strongly recommend you use Virtualenv to install it numpy
pip install virtualenv
go to folder of your code use
virtualenv venv
//Windows
venv\Scripts\activate
//Linux
source venv/bin/activate
you can use conda to install numpy
download conda from here coda GUI installer
Best practice, use an environment rather than install in the base env
conda create -n my-env
conda activate my-env
If you want to install from conda-forge
conda config --env --add channels conda-forge
The actual install command
conda install numpy

ImportError: cannot import name 'Optional' from 'torch.jit.annotations'

I have installed cpuonly pytorch and torchvision in anaconda. But when i try to import torchvision i get the following error.
ImportError: cannot import name 'Optional' from 'torch.jit.annotations'(C:\Users\MSI\Anaconda3\lib\site-packages\torch\jit\annotations.py)
How can i fix this?
Not sure if you are installing the correct versions of the libraries. This combination seems to work:
conda create --name test5 python=3.6
conda install -c pytorch pytorch torchvision cpuonly
python
>>> import torchvision

ImportError cannot import name 'dump_options_header'

whene i run my application odoo in eclipse i got this error
`>from werkzeug.http import dump_options_header, dump_header, generate_etag, \
ImportError: cannot import name 'dump_options_header'
from werkzeug.http import dump_options_header, dump_header, generate_etag, \
quote_header_value, parse_set_header, unquote_etag, quote_etag, \
parse_options_header, http_date, is_byte_range_valid
from werkzeug import exceptions`
what is your version of Werkzeug ?
Find the version with one of this commands
pip list
if you have install flask
flask.__version__
pip freeze | grep Flask
flask --version
If it is 1.0.0 try your after Werkzeug downgrade
pip install Werkzeug==0.16.1

Resources