Cannot import name line_search_wolfe2 - python

I get this error when I try to run a program that uses SciPy 0.7.2.
from scipy.optimize.linesearch import line_search_wolfe2, line_search_wolfe1
ImportError: cannot import name line_search_wolfe2
Why does that happen?

Related

How to fix this "ImportError: cannot import name 'TweepError' from ..."?

The line given below:
from tweepy import API, Stream, OAuthHandler, TweepError
generates ImportError such as:
ImportError: cannot import name 'TweepError' from 'tweepy'
I have tried: from tweepy.errors import TweepError ,however it stills generates error as:
ImportError: cannot import name 'TweepError' from 'tweepy.errors'.
What is it that I am missing here?
TweepError has been replaced with TweepyException since the 4.0.0 (see the changelog).
So use from tweepy.errors import TweepyException (or from tweepy import TweepyException).
And replace TweepError with TweepyException in your code (or with a more specific exception).

Can't import Tf-Pose-Estimator library

When I ask execute this code:
from tf_pose.estimator import TfPoseEstimator
shows error:
cannot import name 'trt_convert' from
'tensorflow.python.compiler.tensorrt'
(C:\Users\AMAN SHRIVASTAVA\anaconda3\lib\
site-packages\tensorflow\python\compiler\
tensorrt\__init__.py)
How can I resolve this?

ModuleNotFoundError while importing from alias

e.g.
import os as my_os
import my_os.path
ModuleNotFoundError: No module named 'my_os'
but the following script is ok
import os
import os.path
You can't do that in Python.
import statements are importing from Python file names.
You aren't renaming the file of os to my_os, therefore this wouldn't work.
As mentioned in the documentation:
The import statement combines two operations; it searches for the named module, then it binds the results of that search to a name in the local scope.
Tried the similar way as os.py did:
import json as my_json
from my_json.decoder import * # ModuleNotFoundError: No module named 'my_json'
import sys
import json.decoder as my_decoder
sys.modules['my_json.decoder'] = my_decoder
from my_json.decoder import * # it's ok now

ImportError: cannot import name 'SegmentationMapsOnImage' from 'imgaug.augmentables.segmaps'

When i import it, i get an error about that.
from imgaug.augmentables.segmaps import SegmentationMapsOnImage
Error:
ImportError: cannot import name 'SegmentationMapsOnImage' from
'imgaug.augmentables.segmaps'
(/usr/local/lib/python3.7/dist-packages/imgaug/augmentables/segmaps.py)
Here is the documentation link
Thanks in advance!

Error in importing a python file

I've written a python file and am trying to import it but it's not recognized.
The file was saved as gentleboost_c_class.c in C:\User\apps\My documents.
I tried to import it like this:
import gentleboost_c_class as gbc
But I get this error:
NameError: name 'gentleboost_c_class' is not defined
gentleboost_c_class.py begins like this:
from sklearn.externals.six.moves import zip
import numpy as np
import statsmodels.api as sm
class GentleBoostC:
.....
It compiles fine.
Both files are in the same folder.
What am I doing wrong?
You're getting a NameError, not an ImportError.
So it seems to me that you import your module as gbc, but later try to refer to it as gentleboost_c_class.
If you import the module with
import gentleboost_c_class as gbc
that means it will be available under the global name gbc, but not as gentleboost_c_class.

Categories

Resources