>>> import face_recognition
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/username/Desktop/face_recognition_low/face_recognition.py", line 30, in <module>
np.set_printoptions(threshold=np.nan)
File "/Users/username/.virtualenvs/cv/lib/python3.6/site-packages/numpy/core/arrayprint.py", line 246, in set_printoptions
floatmode, legacy)
File "/Users/username/.virtualenvs/cv/lib/python3.6/site-packages/numpy/core/arrayprint.py", line 93, in _make_options_dict
raise ValueError("threshold must be numeric and non-NAN, try "
ValueError: threshold must be numeric and non-NAN, try sys.maxsize for untruncated representation
There was no problem importing face_recognition yesterday but all of sudden it does not work. I have no idea how to fix this problem... Any assistance would be highly appreciated.
I restarted my mac and tried again now it works fine. I would like to figure out why...
>>> import dlib
>>> import face_recognition
>>>
Please import sys by import sys.
Then replace
np.set_printoptions(threshold=np.nan)
with
np.set_printoptions(threshold=sys.maxsize)
Related
I have pip installed nflfastpy ,
But when I import it.
running only
import nflfastpy
i get this error message
(pythonCoursera) C:\Users\austi\PycharmProjects\pythonCoursera>python sportsbet.py
Traceback (most recent call last):
File "C:\Users\austi\PycharmProjects\pythonCoursera\sportsbet.py", line 2, in <module>
import nflfastpy as nfl
File "C:\Users\austi\anaconda3\envs\pythonCoursera\lib\site-packages\nflfastpy\__init__.py", line 16, in <module>
default_headshot = mpl_image.imread(headshot_url)
File "C:\Users\austi\anaconda3\envs\pythonCoursera\lib\site-packages\matplotlib\image.py", line 1536, in imread
raise ValueError(
ValueError: Please open the URL for reading and pass the result to Pillow, e.g. with ``np.array(PIL.Image.open(urllib.request.urlopen(url)))``.
on 1 single line of code, nothing else in the file,
I've trie a few versions of it, cant seem to figure it out.
Any suggestions?
That library has a bug and seems to be not actively maintained. You are on your own. At least that image loading error can be avoided by removing the dead code in nflfastpy/__init__.py like the following.
...
#default_headshot = mpl_image.imread(headshot_url)
I'm trying to run a python program that uses the pandas library on Mac OS, and I get the next error
adan_vazquez#EPAM-C02G513RML7L automate_python % python3 test_pandas.py
Traceback (most recent call last):
File "/Users/adan_vazquez/Desktop/automate_python/test_pandas.py", line 1, in <module>
import pandas as pd
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pandas/__init__.py", line 11, in <module>
__import__(dependency)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/__init__.py", line 155, in <module>
from . import random
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/random/__init__.py", line 180, in <module>
from . import _pickle
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/random/_pickle.py", line 1, in <module>
from .mtrand import RandomState
File "mtrand.pyx", line 1, in init numpy.random.mtrand
File "bit_generator.pyx", line 40, in init numpy.random.bit_generator
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/secrets.py", line 19, in <module>
from random import SystemRandom
File "/Users/adan_vazquez/Desktop/automate_python/random.py", line 3, in <module>
print(random.randint(1,10))
AttributeError: partially initialized module 'random' has no attribute 'randint' (most likely due to a circular import)
Here's the code that I'm trying to run:
import pandas as pd
simpsons = pd.read_html('https://en.wikipedia.org/wiki/List_of_The_Simpsons_episodes_(seasons_1%E2%80%9320)')
print(len(simpsons))
print("Hola")
As you can see is not a big code and I'm getting the error, I already updated my pip3 and my python3 versions, also I reinstall pandas and I keep getting the error, if I try to import pandas in the python terminal I get the same error and I don't know what's causing it, I hope you can help me, thanks in advance.
The error message says it is a circular import error.
Try renaming /Users/adan_vazquez/Desktop/automate_python/random.py with something other than random
According to the error, it is a circular import which is causing the problem.
Since I do not have the details of your project structure or file name, my best guess is that you accidentally named your working file the same as the module name and those modules depend on each other.
I'm trying to import the NERDA library in order use it to engage in a Named-Entity Recognition task in Python. I initially tried importing the library in a jupyter notebook and got the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\oefel\AppData\Local\Programs\Python\Python38\lib\site-packages\NERDA\models.py", line 13, in <module>
from .networks import NERDANetwork
File "C:\Users\oefel\AppData\Local\Programs\Python\Python38\lib\site-packages\NERDA\networks.py", line 4, in <module>
from transformers import AutoConfig
File "C:\Users\oefel\AppData\Local\Programs\Python\Python38\lib\site-packages\transformers\__init__.py", line 43, in <module>
from . import dependency_versions_check
File "C:\Users\oefel\AppData\Local\Programs\Python\Python38\lib\site-packages\transformers\dependency_versions_check.py", line 36, in <module>
from .file_utils import is_tokenizers_available
File "C:\Users\oefel\AppData\Local\Programs\Python\Python38\lib\site-packages\transformers\file_utils.py", line 51, in <module>
from huggingface_hub import HfApi, HfFolder, Repository
File "C:\Users\oefel\AppData\Local\Programs\Python\Python38\lib\site-packages\huggingface_hub\__init__.py", line 31, in <module>
from .file_download import cached_download, hf_hub_url
File "C:\Users\oefel\AppData\Local\Programs\Python\Python38\lib\site-packages\huggingface_hub\file_download.py", line 37, in <module>
if tuple(int(i) for i in _PY_VERSION.split(".")) < (3, 8, 0):
File "C:\Users\oefel\AppData\Local\Programs\Python\Python38\lib\site-packages\huggingface_hub\file_download.py", line 37, in <genexpr>
if tuple(int(i) for i in _PY_VERSION.split(".")) < (3, 8, 0):
ValueError: invalid literal for int() with base 10: '6rc1'
I then tried globally installing using pip in gitbash and got the same error. The library appeared to install without error but when I try the following import, I get that same ValueError:
from NERDA.models import NERDA
I've also tried some of the pre-cooked model imports and gotten the same ValueError.
from NERDA.precooked import EN_ELECTRA_EN
from NERDA.precooked import EN_BERT_ML
I can't find anything on this error online and am hoping someone may be able to lend some insight? Thanks so much!
Take a look at the source code of the used huggingface_hub lib. They comparing the version of your python version to do different imports.
But you uses a release candidate python version (this tells the value '6rc1', that caused the error). Because they didn't expect/handle this, you get the int-parse-ValueError.
Solution 1:
Update your python version to a stable version. No release candidate. So you have an int-only version number.
Solution 2:
Monkeypatch sys.version, before you import the NERDA libs.
sys.version = '3.8.0'
I was using a tkform(https://github.com/boscoh/tkform) with Python2 and it was working perfectly.
After switching to Python3, Im unable to run it, specifically the part:
from idlelib.WidgetRedirector import WidgetRedirector
It seems that WidgetRedirecor.py not even in the library (idellib) anymore...
Traceback (most recent call last):
File "/Users/igor/opt/cymorph3/runCyMorphGUI.py", line 7, in <module>
import tkform
File "gui/tkform.py", line 22, in <module>
from idlelib import WidgetRedirector
ImportError: cannot import name 'WidgetRedirector' from 'idlelib' (/Users/igor/opt/anaconda3/envs/cyMorph3/lib/python3.9/idlelib/__init__.py)
Can I fix it somehow?
Use:
from idlelib.redirector import WidgetRedirector
So I am having a bit of trouble using scipy. I have been importing data from a .mat file (matlab variables) and up until today it has worked perfectly. I have no idea what changed or when because I have been developing a text - based data format so that I can avoid depending on Matlab for writing my data. Anyways, I am getting a bizzare import error when I import scipy.io
import scipy.io
myData = scipy.io.loadmat('some_data_file')
When I run this I get the following error:
>>> import scipy.io
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\pyzo2014a\lib\site-packages\scipy\io\__init__.py", line 85, in <module>
from .matlab import loadmat, savemat, whosmat, byteordercodes
File "C:\pyzo2014a\lib\site-packages\scipy\io\matlab\__init__.py", line 13, in <module>
from .mio import loadmat, savemat, whosmat
File "C:\pyzo2014a\lib\site-packages\scipy\io\matlab\mio.py", line 13, in <module>
from .mio4 import MatFile4Reader, MatFile4Writer
File "C:\pyzo2014a\lib\site-packages\scipy\io\matlab\mio4.py", line 11, in <module>
import scipy.sparse
File "C:\pyzo2014a\lib\site-packages\scipy\sparse\__init__.py", line 217, in <module>
from .csgraph import cs_graph_components
File "C:\pyzo2014a\lib\site-packages\scipy\sparse\csgraph\__init__.py", line 148, in <module>
from ._shortest_path import shortest_path, floyd_warshall, dijkstra,\
ImportError: No module named 'scipy.sparse.csgraph._shortest_path'
I thought there might be something wrong with my python distribution so I reinstalled it, however the problem persists, and now the installer says it can't find '_shortest_path.py' when it is installing. When I navigate to .../Libs/site-packages/scipy/sparse/csgraph/ I find that indeed there is no module named _shortest_path. I don't understand how this error came about or how anything in my code would change it. Has anyone else come across this problem?
I am using Pyzo 2014 on Windows 7 x64.
Restore shortest_path.pyd in your virust chest
http://www.blendernation.com/2014/06/28/getting-a-virus-warning-with-blender-2-71-heres-why/