Good day,
I get the following error when importing xlrd. Does any one get this?
import xlrd
Error:
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
import xlrd
File "C:\Users\irwin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\xlrd\__init__.py", line 1187
print "EXTERNSHEET(b7-):"
^
SyntaxError: invalid syntax
Related
import mysql.connector
I was trying to make a database using python. I used the code shown below after the installation of MySQL-connector-python to the python interpreter, but the following output shows in the terminal:
Traceback (most recent call last):
File "F:\coding\sql-course-materials\SQL Course Materials\mysql.py", line 1, in <module>
import mysql.connector
File "F:\coding\sql-course-materials\SQL Course Materials\mysql.py", line 1, in <module>
import mysql.connector
ModuleNotFoundError: No module named 'mysql.connector'; 'mysql' is not a package
I'm trying to run python code that uses the pandas library on the BeagleBone Black. I have all the necessary libraries and packages downloaded onto the device. When I try to run the code, I get an error regarding the numpy.ndarray size being changed. Currently, I am using Python 3.7.3, numpy 1.20.1, and pandas 1.3.5.
When I try to my python file, an error occurs with importing the pandas library. The traceback of the error I'm encountering is included below. I have tried the following to resolve this issue:
pip install --upgrade numpy
and
pip uninstall numpy
pip install numpy
as suggested here.
Traceback
root#beaglebone:/mnt/microSD# python chunkANDconvert.py
Traceback (most recent call last):
File "chunkANDconvert.py", line 2, in <module>
import pandas as pd
File "/usr/local/lib/python3.7/dist-packages/pandas/__init__.py", line 22, in <module>
from pandas.compat import (
File "/usr/local/lib/python3.7/dist-packages/pandas/compat/__init__.py", line 15, in <module>
from pandas.compat.numpy import (
File "/usr/local/lib/python3.7/dist-packages/pandas/compat/numpy/__init__.py", line 7, in <module>
from pandas.util.version import Version
File "/usr/local/lib/python3.7/dist-packages/pandas/util/__init__.py", line 1, in <module>
from pandas.util._decorators import ( # noqa
File "/usr/local/lib/python3.7/dist-packages/pandas/util/_decorators.py", line 14, in <module>
from pandas._libs.properties import cache_readonly # noqa
File "/usr/local/lib/python3.7/dist-packages/pandas/_libs/__init__.py", line 13, in <module>
from pandas._libs.interval import Interval
File "pandas/_libs/interval.pyx", line 1, in init pandas._libs.interval
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 44 from C header, got 40 from PyObject
I use python 3.8.6 and I have loaded Keras 2.2.2, TensorFlow-GPU 2.2.0.
When I run my code, I have this error:
Using TensorFlow backend.
Traceback (most recent call last):
File "XX.py", line 23, in <module>
import keras
File ".local/lib/python3.8/site-packages/keras/__init__.py", line 5, in <module>
from . import applications
File ".local/lib/python3.8/site-packages/keras/applications/__init__.py", line 11, in <module>
import keras_applications
File ".local/lib/python3.8/site-packages/keras_applications/__init__.py", line 8, in <module>
from keras_applications import vgg16
File ".local/lib/python3.8/site-packages/keras_applications/vgg16.py", line 15, in <module>
from . import get_keras_submodule
ImportError: cannot import name 'get_keras_submodule' from partially initialized module 'keras_applications' (most likely due to a circular import) (/local/lib/python3.8/site-packages/keras_applications/__init__.py)
How to solve this error other than downgrade the TensorFlow version?
Thanks!
I have pyscripter version 3.2.2.0 x86 running python 3.6.3
When I want to import pandas in a py module(i.e. import pandas as pd),
I end up with an exception : invalid syntax
Traceback (most recent call last):
File "<string>", line 424, in run_nodebug
File "<module1>", line 13, in <module>
File "D:\Users\Jean\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pandas\__init__.py", line 13, in <module>
__import__(dependency)
File "D:\Users\Jean\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pytz\__init__.py", line 19, in <module>
from pytz.lazy import LazyDict, LazyList, LazySet
File "D:\Users\Jean\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pytz\lazy.py", line 3, in <module>
from UserDict import DictMixin
File "D:/Users/Jean\Desktop/Kodi Python Development/PythonPourDebutants/App/Lib\UserDict.py", line 134
raise TypeError, "pop expected at most 2 arguments, got "\
^
SyntaxError: invalid syntax
but when I import in command line, everything is ok !
why is it so ?
thanks for your answers !
I am running Python 3.5.1 on Windows 10 and have Anaconda and IDLE installed.
If I run any Python files, pandas and numpy seem to work in Jupyter notebooks, but not in IDLE.
I have ensured that the PATH and PYTHONPATH environment variables include access to the folders where pandas and numpy are located (Lib/site-packages).
I receive the following error in IDLE when trying to import pandas:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import pandas
File "C:\Users\me\AppData\Local\Continuum\Anaconda3\Lib\site-packages\pandas\__init__.py", line 18, in <module>
raise ImportError("Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['numpy']
When I try to import numpy I get the following error:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import numpy
File "C:\Users\me\AppData\Local\Continuum\Anaconda3\Lib\site-packages\numpy\__init__.py", line 180, in <module>
from . import add_newdocs
File "C:\Users\me\AppData\Local\Continuum\Anaconda3\Lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Users\me\AppData\Local\Continuum\Anaconda3\Lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Users\me\AppData\Local\Continuum\Anaconda3\Lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Users\me\AppData\Local\Continuum\Anaconda3\Lib\site-packages\numpy\core\__init__.py", line 14, in <module>
from . import multiarray
ImportError: cannot import name 'multiarray'
Can someone help?
try this:
I had the same problem
https://stackoverflow.com/a/40637960/6376603
maybe the above answer will help.
I had similar problem. I uninstalled anaconda from my system completely.
Steps - Delete app, delete anaconda3 folder, empty trash
Then I reinstalled older version of it and it started working perfectly. Maybe it is some kind of bug in the newer version.