Can someone help me to solve this pycharm error xlrd - import-from-excel

Traceback (most recent call last): File "D:\PyCharm Community Edition 2021.1\Python files\ReadExelFile.py", line 5, in wb= xlrd.open_workbook(x) File "D:\PyCharm Community Edition 2021.1\venv\lib\site-packages\xlrd_init_.py", line 170, in open_workbook raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+'; not supported') xlrd.biffh.XLRDError: Excel xlsx file; not supported

upgrade your xlrd package
pip3 install --upgrade xlrd
or use this package to read xlsx files
https://openpyxl.readthedocs.io/en/stable/
pip3 install openpyxl

Related

SyntaxError: invalid syntax when trying to import networkx in Python3 (Ubuntu 16.04)

I use a DigitalOcean server running Ubuntu 16.04, and I have used networkx before with Python3. But when I tried to import networkx today, I received a syntax error.
$ python3
Python 3.5.2 (default, Oct 7 2020, 17:19:02)
[GCC 5.4.0 --------] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import networkx as nx
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/networkx/__init__.py", line 23
f"{release.authors['Hagberg'][0]} <{release.authors['Hagberg'][1]}>\n"
^
SyntaxError: invalid syntax
I also tried to uninstall and reinstall networkx, but I now get other syntax errors.
$ sudo pip3 uninstall networkx
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 7, in <module>
from pip._internal.cli.main import main
File "/usr/local/lib/python3.5/dist-packages/pip/_internal/cli/main.py", line 60
sys.stderr.write(f"ERROR: {exc}")
^
SyntaxError: invalid syntax
... on the attempt at install :
$ sudo pip3 install networkx
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 7, in <module>
from pip._internal.cli.main import main
File "/usr/local/lib/python3.5/dist-packages/pip/_internal/cli/main.py", line 60
sys.stderr.write(f"ERROR: {exc}")
^
SyntaxError: invalid syntax
I researched online, and I saw that I needed to do updates, which I ran.
sudo apt update
sudo apt upgrade
sudo apt-get install python3-pip python3-dev
But these errors continue. Is there a dependency file I need to go in and manually change to Python3.5 ? I saw that somewhere. It feels like this is a stupid problem, and these are the kinds that always trip me up. Any help would be greatly appreciated. Thank you.
I had to uninstall networkx and reinstall the prior version. That solved the issue.
$ sudo pip3 uninstall networkx
$ sudo pip3 install networkx==2.4
I was then able to run python3 and import networkx.
The bug was apparently from the current version of networkx (2.5). (I found this solution after I attempted a python uninstall/install, which crashed my server, and I was forced to restore to a prior back-up.) Don't ask me why this happened.

Rasa NLU installation issue

I had rasa nlu version 0.12.3 installed. I had some issues and uninstalled rasa nlu and other requirements using
pip uninstall rasa_nlu
pip uninstall -r requirements.txt
Now when I am installing rasa nlu again using pip install rasa_nlu
I see below messages in the terminal
Error processing line 1 of /Users/uername/anaconda3/lib/python3.6/site-packages/matplotlib-2.0.2-py3.6-nspkg.pth:
Traceback (most recent call last):
File "/Users/username/anaconda3/lib/python3.6/site.py", line 168, in addpackage
exec(line)
File "<string>", line 1, in <module>
File "<frozen importlib._bootstrap>", line 557, in module_from_spec
AttributeError: 'NoneType' object has no attribute 'loader'
Remainder of file ignored
There are more messages regarding installation and the final message is
Found existing installation: greenlet 0.4.12
Cannot uninstall 'greenlet'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
And it turns out that rasa nlu is not installed. I know that the nlu is not installed because when I check the nlu version with below command
python -c "import rasa_nlu; print(rasa_nlu.__version__);"
I get error
Error processing line 1 of /Users/username/anaconda3/lib/python3.6/site-packages/matplotlib-2.0.2-py3.6-nspkg.pth:
Traceback (most recent call last):
File "/Users/username/anaconda3/lib/python3.6/site.py", line 168, in addpackage
exec(line)
File "<string>", line 1, in <module>
File "<frozen importlib._bootstrap>", line 557, in module_from_spec
AttributeError: 'NoneType' object has no attribute 'loader'
Remainder of file ignored
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'rasa_nlu'
Turns out the problem was happening due to a distutils installed project which the pip install couldn't uninstall before installation.
So I had to use --ignore-installed
In short, below command solved the problem
sudo pip install --ignore-installed rasa_nlu
If you want to uninstall python package which is part of distutils, you can manually remove the folder from 'site-packages' folder. If it is Anaconda distribution, it will be in following folder. I suggest to cut the folder and paste it somewhere else for the backup purpose.
In windows:
C:\Users\\AppData\Local\Continuum\Anaconda3\Lib\site-packages
I'm sure Linux will have similar folder structure.
Following 2 items needs to be removed.
Folder [package version no.]
File - [package>.egg-info]
As mentioned in Rasa's official documentation, Install it with
pip3 install rasa-x --extra-index-url https://pypi.rasa.com/simple
It will install Rasa X and Rasa. It works great.
pip3 install rasa-x -U --extra-index-url https://pypi.rasa.com/simple
installation guide

Geodjango Exception when importing django.contrib.gis.gdal: OSError: /usr/lib/libgdal.so.1: undefined symbol: sqlite3_column_table_name

I have followed the tutorial for installing Geodjango on my Ubuntu 14.04. I am using Django 1.10 and Python 3.5, postgres-9.6 and postgis 2.3.
I have checked here and here, but found no solution.
In a newly installed ubuntu 14.04 Virtual Machine, it worked.
But in my installation, when I tried making migrations, I got:
OSError: /usr/lib/libgdal.so.1: undefined symbol: sqlite3_column_table_name
Investigating a bit further, I tried simply:
from django.contrib.gis import gdal
And got:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pv/anaconda3/envs/dj110py35/lib/python3.5/site-packages/django/contrib/gis/gdal/__init__.py", line 49, in <module>
from django.contrib.gis.gdal.driver import Driver # NOQA
File "/home/pv/anaconda3/envs/dj110py35/lib/python3.5/site-packages/django/contrib/gis/gdal/driver.py", line 5, in <module>
from django.contrib.gis.gdal.prototypes import ds as vcapi, raster as rcapi
File "/home/pv/anaconda3/envs/dj110py35/lib/python3.5/site-packages/django/contrib/gis/gdal/prototypes/ds.py", line 9, in <module>
from django.contrib.gis.gdal.libgdal import GDAL_VERSION, lgdal
File "/home/pv/anaconda3/envs/dj110py35/lib/python3.5/site-packages/django/contrib/gis/gdal/libgdal.py", line 48, in <module>
lgdal = CDLL(lib_path)
File "/home/pv/anaconda3/envs/dj110py35/lib/python3.5/ctypes/__init__.py", line 347, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /usr/lib/libgdal.so.1: undefined symbol: sqlite3_column_table_name
Is there any suggestions on how I could repair my setup?
UPDATE
It seems to be a problema with my conda environment. When I started using a pip virtualenv, the problem did not arise anymore. I am not answering the question, because I could not find the solution, only a workaround. But rebuilding the environment with pip virtualenv works.
In conda environment: conda install -c conda-forge gdal=2.2.1
In django settings.py:
GDAL_LIBRARY_PATH = '<HOME>/anaconda3/envs/<env_name>/lib/libgdal.so'
I was having this issue as well and the specifying
GDAL_LIBRARY_PATH = <HOME>/anaconda3/envs/<env_name>/lib/libgdal.so
(in project.settings or os.environ.setdefault) led to
libicui18n.so.56: cannot open shared object file: No such file or directory.
The fix that worked for me was to upgrade icu:
conda install -c conda-forge icu=58
Upgrading icu lead to some changes in other package versions as well (qt downgraded from 5.6.2-4 to 5.6.2-3, the rest upgraded).
I simply run under my conda environment:
conda install gdal
Guy de Carufel's solution did not work for me, though he pointed to a correct direction, thanks
Have you built SQLite from source? Then, you forgot to enable Column metadata. Recompile SQLite with
CFLAGS="-DSQLITE_ENABLE_COLUMN_METADATA=1" ./configure
make
sudo make install
Have fun using the cutting edge SQLite.
Reference - https://www.sqlite.org/compile.html#enable_column_metadata

upgrading scipy in mac

I want to upgrade scipy. and I used pip install scipy --upgrade to do this, but here is error, how should I fix this?
Installing collected packages: scipy
Found existing installation: scipy 0.13.0b1
DEPRECATION: Uninstalling a distutils installed project (scipy) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling scipy-0.13.0b1:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/var/folders/7x/1ly_pjjd3g50632kc7mc68n00000gn/T/pip-a37H18-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/scipy-0.13.0b1-py2.7.egg-info'
Python version 2.7.10
Mac version 10.12.04
I tried to install face_recognition, then display the same problem.
sudo pip install face_recognition
try use:
sudo pip install --upgrade scipy --ignore-installed six

orange3-associate install fails, other add-ons install without issue

Install error for Orang3-Associate add-on on a Windows7 PC
Command:
pip install Orange3-Associate (same result from UI Options - Add-Ons)
Error:
Collecting Orange3-Associate
Using cached Orange3-Associate-0.1.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "C:\cygwin64\tmp\pip-build-nzb1zehp\Orange3-Associate\setup.py", line 32, in <module>
long_description=open(path.join(path.dirname(__file__), 'README.md')).re ad(),
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\cygwin64\\tmp\\ pip-build-nzb1zehp\\Orange3-Associate\\README.md'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\cygwin64\tmp\p ip-build-nzb1zehp\Orange3-Associate
Add-ons DataFusion and Text successfully installed.
Thanks. This was a bug in Orange3-Associate 0.1.1. It is hopefully fixed in 0.1.2, already available through pip or Options | Add-ons.