Module 'Tabula' not found in python spyder - python

I tried to run this code:
from tabula import read_pdf
df = read_pdf("../pdf/Documentacao.pdf")
print(df)
And got this:
runfile('C:/Users/Henri/git/Git/PDS1/dev/lib/planilhas01.py', wdir='C:/Users/Henri/git/Git/PDS1/dev/lib')
Traceback (most recent call last):
File "<ipython-input-4-e12a8a26bbfa>", line 1, in <module>
runfile('C:/Users/Henri/git/Git/PDS1/dev/lib/planilhas01.py', wdir='C:/Users/Henri/git/Git/PDS1/dev/lib')
File "C:\Users\Henri\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
execfile(filename, namespace)
File "C:\Users\Henri\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/Henri/git/Git/PDS1/dev/lib/planilhas01.py", line 1, in <module>
from tabula import read_pdf
ModuleNotFoundError: No module named 'tabula'
This is what my anaconda says:
(base) C:\Users\Henri>pip install tabula-py
Requirement already satisfied: tabula-py in c:\users\henri\miniconda3\lib\site-packages (1.4.1)
Requirement already satisfied: pandas in c:\users\henri\miniconda3\lib\site-packages (from tabula-py) (0.25.1)
Requirement already satisfied: distro in c:\users\henri\miniconda3\lib\site-packages (from tabula-py) (1.4.0)
Requirement already satisfied: numpy in c:\users\henri\miniconda3\lib\site-packages (from tabula-py) (1.17.2)
Requirement already satisfied: python-dateutil>=2.6.1 in c:\users\henri\miniconda3\lib\site-packages (from pandas->tabula-py) (2.8.0)
Requirement already satisfied: pytz>=2017.2 in c:\users\henri\miniconda3\lib\site-packages (from pandas->tabula-py) (2019.3)
Requirement already satisfied: six>=1.5 in c:\users\henri\miniconda3\lib\site-packages (from python-dateutil>=2.6.1->pandas->tabula-py) (1.12.0)
I think is something about directories, but what ??

(base) C:\Users\Henri>pip install tabula-py
Requirement already satisfied: tabula-py in c:\users\henri\miniconda3\lib\site-packages (1.4.1)
I think is installed, just you need to make sure which Python environment yre installing it because maybe is installed in python3 directory, not python2.

Related

Problems installing pyinstaller

I tried pip install and received this:
Requirement already satisfied: pyinstaller in c:\users\sinwe\appdata\local\programs\python\python39\lib\site-packages (4.5.1)
Requirement already satisfied: altgraph in c:\users\sinwe\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (0.17)
Requirement already satisfied: pyinstaller-hooks-contrib>=2020.6 in c:\users\sinwe\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (2021.2)
Requirement already satisfied: pywin32-ctypes>=0.2.0 in c:\users\sinwe\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (0.2.0)
Requirement already satisfied: pefile>=2017.8.1 in c:\users\sinwe\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (2021.5.24)
Requirement already satisfied: setuptools in c:\users\sinwe\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (49.2.1)
Requirement already satisfied: future in c:\users\sinwe\appdata\local\programs\python\python39\lib\site-packages (from pefile>=2017.8.1->pyinstaller) (0.18.2)
I then installed using setup.py
To check whether it is installed, in cmd:
pyinstaller --version
and I received this:
Traceback (most recent call last):
File "C:\Users\sinwe\AppData\Local\Programs\Python\Python39\Scripts\pyinstaller-script.py", line 33, in <module>
sys.exit(load_entry_point('pyinstaller==4.5.1', 'console_scripts', 'pyinstaller')())
File "C:\Users\sinwe\AppData\Local\Programs\Python\Python39\Scripts\pyinstaller-script.py", line 25, in importlib_load_entry_point
return next(matches).load()
StopIteration
Could anyone provide a solution?
Try to uninstall pyinstaller using:
pip uninstall pyinstaller
in the cmd, and upgrade pip:
pip install --upgrade pip
And then try to install pyinstaller again:
pip install pyinstaller

linear models: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject"

I get this error when I try to import linearmodels: "numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject"
I run Anaconda, python 3.8.8 on Windows 10. It is a fresh installation of Anaconda Python on a new machine.
I tried to solve this problem by using an older NumPy version (1.6.1, see this link) in a separate environment. Alas.
This is the output that shows which versions of libraries I use, and note the real path is not c:\users\, but c:\users\myusername\
Requirement already satisfied: linearmodels in c:\users\anaconda3\lib\site-packages (4.21)
Requirement already satisfied: pandas>=0.24 in c:\users\anaconda3\lib\site-packages (from linearmodels) (1.2.3)
Requirement already satisfied: pyhdfe>=0.1 in c:\users\anaconda3\lib\site-packages (from linearmodels) (0.1.0)
Requirement already satisfied: scipy>=1.2 in c:\users\anaconda3\lib\site-packages (from linearmodels) (1.6.1)
Requirement already satisfied: statsmodels>=0.11 in c:\users\anaconda3\lib\site-packages (from linearmodels) (0.12.2)
Requirement already satisfied: mypy-extensions>=0.4 in c:\users\anaconda3\lib\site-packages (from linearmodels) (0.4.3)
Requirement already satisfied: property-cached>=1.6.3 in c:\users\anaconda3\lib\site-packages (from linearmodels) (1.6.4)
Requirement already satisfied: numpy>=1.16 in c:\users\anaconda3\lib\site-packages (from linearmodels) (1.19.2)
Requirement already satisfied: patsy in c:\users\anaconda3\lib\site-packages (from linearmodels) (0.5.1)
Requirement already satisfied: Cython>=0.29.21 in c:\users\anaconda3\lib\site-packages (from linearmodels) (0.29.22)
Requirement already satisfied: python-dateutil>=2.7.3 in c:\users\anaconda3\lib\site-packages (from pandas>=0.24->linearmodels) (2.8.1)
Requirement already satisfied: pytz>=2017.3 in c:\users\anaconda3\lib\site-packages (from pandas>=0.24->linearmodels) (2021.1)
Requirement already satisfied: six>=1.5 in c:\users\anaconda3\lib\site-packages (from python-dateutil>=2.7.3->pandas>=0.24->linearmodels) (1.15.0)
This is what proceeds he error:
from linearmodels import PanelOLS
Traceback (most recent call last):
File "<ipython-input-2-6de63ba6aa3f>", line 1, in <module>
from linearmodels import PanelOLS
File "C:\Users\Anaconda3\lib\site-packages\linearmodels\__init__.py", line 38, in <module>
from .asset_pricing.model import (
File "C:\Users\Anaconda3\lib\site-packages\linearmodels\asset_pricing\__init__.py", line 1, in <module>
from .model import LinearFactorModel, LinearFactorModelGMM, TradedFactorModel
File "C:\Users\Anaconda3\lib\site-packages\linearmodels\asset_pricing\model.py", line 13, in <module>
from linearmodels.asset_pricing.covariance import (
File "C:\Users\Anaconda3\lib\site-packages\linearmodels\asset_pricing\covariance.py", line 9, in <module>
from linearmodels.iv.covariance import (
File "C:\Users\Anaconda3\lib\site-packages\linearmodels\iv\__init__.py", line 1, in <module>
from .absorbing import AbsorbingLS, Interaction # flake8: noqa
File "C:\Users\Anaconda3\lib\site-packages\linearmodels\iv\absorbing.py", line 54, in <module>
from linearmodels.panel.utility import (
File "C:\Users\Anaconda3\lib\site-packages\linearmodels\panel\__init__.py", line 1, in <module>
from linearmodels.panel.model import (
File "C:\Users\Anaconda3\lib\site-packages\linearmodels\panel\model.py", line 28, in <module>
from linearmodels.panel.utility import (
File "C:\Users\Anaconda3\lib\site-packages\linearmodels\panel\utility.py", line 24, in <module>
from linearmodels.panel._utility import _drop_singletons
File "linearmodels\panel\_utility.pyx", line 1, in init linearmodels.panel._utility
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject
This has been solved by updating to the latest linearmodels version: 4.22

How to fix "UnicodeDecodeError" for EbookLib when installing Textract?

When trying to install the Textract package in pycharm on Windows 10, the package installer returns a UnicodeDecodeError for EbookLib 0.15 in the README.md.
I have attempted the solutions provided at: https://github.com/deanmalmgren/textract/issues/194
and the solutions provided almost worked for EbookLib except running pip install textract
in terminal does not seem to install the actual module.
E:\Main>pip install textract
Requirement already satisfied: textract in e:\conda\lib\site-packages (1.6.1)
Requirement already satisfied: EbookLib==0.15 in e:\ebooklib-0.15 (from textract) (0.15)
Requirement already satisfied: python-pptx==0.6.5 in e:\conda\lib\site-packages (from textract) (0.6.5)
Requirement already satisfied: argcomplete==1.8.2 in e:\conda\lib\site-packages (from textract) (1.8.2)
Requirement already satisfied: docx2txt==0.6 in e:\conda\lib\site-packages (from textract) (0.6)
Requirement already satisfied: SpeechRecognition==3.6.3 in e:\conda\lib\site-packages (from textract) (3.6.3)
Requirement already satisfied: xlrd==1.0.0 in e:\conda\lib\site-packages (from textract) (1.0.0)
Requirement already satisfied: six==1.10.0 in e:\conda\lib\site-packages (from textract) (1.10.0)
Requirement already satisfied: chardet==2.3.0 in e:\conda\lib\site-packages (from textract) (2.3.0)
Requirement already satisfied: beautifulsoup4==4.5.3 in e:\conda\lib\site-packages (from textract) (4.5.3)
Requirement already satisfied: pocketsphinx==0.1.3 in e:\conda\lib\site-packages (from textract) (0.1.3)
Requirement already satisfied: lxml in e:\conda\lib\site-packages (from EbookLib==0.15->textract) (4.3.3)
Requirement already satisfied: XlsxWriter>=0.5.7 in e:\conda\lib\site-packages (from python-pptx==0.6.5->textract)
(1.1.8)
Requirement already satisfied: Pillow>=2.6.1 in e:\conda\lib\site-packages (from python-pptx==0.6.5->textract) (6.0
.0)
>>>import textract
Traceback (most recent call last):
File "E:/Main/Main.py", line 22, in <module>
import textract
ModuleNotFoundError: No module named 'textract'
The installer should properly receive the EbookLib version and run its setup.py but it ends up using the flawed version that has been cached rather than the local file I have decoded.
Collecting EbookLib==0.15 (from textract)
Using cached https://files.pythonhosted.org/packages/04/30/2cbf65fa9587a1ecc66a78eea91f9189ead8fdadd5e009115bce34529aa6/EbookLib-0.15.tar.gz
ERROR: Complete output from command python setup.py egg_info:
ERROR: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Feraz\AppData\Local\Temp\pycharm-packaging\EbookLib\setup.py", line 13, in <module>
long_description = open('README.md').read(),
File "E:\Python37\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 1671: character maps to <undefined>
----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in C:\Users\Feraz\AppData\Local\Temp\pycharm-packaging\EbookLib\

Unable to install python module paramiko successfully on mac

1)Installed paramiko on mac, but getting some different errors.
pip install paramiko
Requirement already satisfied: paramiko in /Library/Python/2.7/site-packages
Requirement already satisfied: pynacl>=1.0.1 in /Library/Python/2.7/site-packages (from paramiko)
Requirement already satisfied: pyasn1>=0.1.7 in /Library/Python/2.7/site-packages (from paramiko)
Requirement already satisfied: bcrypt>=3.1.3 in /Library/Python/2.7/site-packages (from paramiko)
Requirement already satisfied: cryptography>=1.1 in /Library/Python/2.7/site-packages (from paramiko)
Requirement already satisfied: six in ./2.7/Extras/lib/python (from pynacl>=1.0.1->paramiko)
Requirement already satisfied: cffi>=1.4.1 in /Library/Python/2.7/site-packages (from pynacl>=1.0.1->paramiko)
Requirement already satisfied: idna>=2.1 in /Library/Python/2.7/site-packages (from cryptography>=1.1->paramiko)
Requirement already satisfied: ipaddress in /Library/Python/2.7/site-packages (from cryptography>=1.1->paramiko)
Requirement already satisfied: asn1crypto>=0.21.0 in /Library/Python/2.7/site-packages (from cryptography>=1.1->paramiko)
Requirement already satisfied: enum34 in /Library/Python/2.7/site-packages (from cryptography>=1.1->paramiko)
Requirement already satisfied: pycparser in /Library/Python/2.7/site-packages (from cffi>=1.4.1->pynacl>=1.0.1->paramiko)
Open the terminal, type python. Now in python prompt, import paramiko
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/paramiko/__init__.py", line 31, in <module>
from paramiko.transport import SecurityOptions, Transport
File "/Library/Python/2.7/site-packages/paramiko/transport.py", line 57, in <module>
from paramiko.ed25519key import Ed25519Key
File "/Library/Python/2.7/site-packages/paramiko/ed25519key.py", line 22, in <module>
import nacl.signing
File "/Library/Python/2.7/site-packages/nacl/signing.py", line 19, in <module>
import nacl.bindings
File "/Library/Python/2.7/site-packages/nacl/bindings/__init__.py", line 17, in <module>
from nacl.bindings.crypto_box import (
File "/Library/Python/2.7/site-packages/nacl/bindings/crypto_box.py", line 18, in <module>
from nacl._sodium import ffi, lib
ImportError: dlopen(/Library/Python/2.7/site-packages/nacl/_sodium.so, 2): Symbol not found: _crypto_box
Referenced from: /Library/Python/2.7/site-packages/nacl/_sodium.so
Expected in: flat namespace
in /Library/Python/2.7/site-packages/nacl/_sodium.so
2) After trying some different options, tried sudo -H pip install paramiko and import paramiko from python prompt didn't result into any error.
But when executed paramiko login snippet, resulted into an error Client.py and transport.py & module error certificate transparency

google cloud machine learning tutorial error

I'm new to machine learning, today I follow this tutorial:
https://codelabs.developers.google.com/codelabs/cpb102-txf-learning/index.html
But at step 5 I got an error
chuanman2707#transfer-learning-169510:~$ cd cloudml-samples/flowers
chuanman2707#transfer-learning-169510:~/cloudml-samples/flowers$
DICT_FILE=gs://cloud-ml-data/img/flower_photos/dict.txt
chuanman2707#transfer-learning-169510:~/cloudml-samples/flowers$
PROJECT=$(gcloud config list project --format "value(core.project)")
chuanman2707#transfer-learning-169510:~/cloudml-samples/flowers$
BUCKET="gs://${PROJECT}-flower"
chuanman2707#transfer-learning-169510:~/cloudml-samples/flowers$
GCS_PATH="${BUCKET}/${USER}"
chuanman2707#transfer-learning-169510:~/cloudml-samples/flowers$ gsutil mb
$BUCKET
Creating gs://transfer-learning-169510-flower/...
chuanman2707#transfer-learning-169510:~/cloudml-samples/flowers$ python
trainer/preprocess.py \
> --input_dict "$DICT_FILE" \
> --input_path "gs://cloud-ml-data/img/flower_photos/eval_set.csv" \
> --output_path "${GCS_PATH}/preproc/eval" \
> --cloud
Traceback (most recent call last):
File "trainer/preprocess.py", line 71, in <module>
import apache_beam as beam
ImportError: No module named apache_beam
Please help me go through this tutorial. Thank you.
edit
After I tried to install pip install apache-beam I got this:
chuanman2707#transfer-learning-169510:~/cloudml-samples/flowers$ pip install apache-beam
Collecting apache-beam
Collecting avro<2.0.0,>=1.8.1 (from apache-beam)
Requirement already satisfied: mock<3.0.0,>=1.0.1 in /usr/local/lib/python2.7/dist-packages (from apache-beam)
Requirement already satisfied: crcmod<2.0,>=1.7 in /usr/local/lib/python2.7/dist-packages (from apache-beam)
Requirement already satisfied: grpcio<2.0,>=1.0 in /usr/local/lib/python2.7/dist-packages (from apache-beam)
Collecting protobuf==3.2.0 (from apache-beam)
Using cached protobuf-3.2.0-cp27-cp27mu-manylinux1_x86_64.whl
Collecting oauth2client<4.0.0,>=2.0.1 (from apache-beam)
Collecting httplib2<0.10,>=0.8 (from apache-beam)
Requirement already satisfied: pyyaml<4.0.0,>=3.12 in /home/chuanman2707/.local/lib/python2.7/site-packages (from apache-beam)
Requirement already satisfied: dill==0.2.6 in /usr/local/lib/python2.7/dist-packages (from apache-beam)
Requirement already satisfied: funcsigs>=1; python_version < "3.3" in /usr/local/lib/python2.7/dist-packages (from mock<3.0.0,>=1.0.1->apache-beam)
Requirement already satisfied: six>=1.9 in /usr/local/lib/python2.7/dist-packages (from mock<3.0.0,>=1.0.1->apache-beam)
Requirement already satisfied: pbr>=0.11 in /usr/local/lib/python2.7/dist-packages (from mock<3.0.0,>=1.0.1->apache-beam)
Requirement already satisfied: enum34>=1.0.4 in /usr/local/lib/python2.7/dist-packages (from grpcio<2.0,>=1.0->apache-beam)
Requirement already satisfied: futures>=2.2.0 in /usr/local/lib/python2.7/dist-packages (from grpcio<2.0,>=1.0->apache-beam)
Requirement already satisfied: setuptools in /usr/local/lib/python2.7/dist-packages (from protobuf==3.2.0->apache-beam)
Requirement already satisfied: rsa>=3.1.4 in /usr/local/lib/python2.7/dist-packages (from oauth2client<4.0.0,>=2.0.1->apache-beam)
Requirement already satisfied: pyasn1>=0.1.7 in /usr/local/lib/python2.7/dist-packages (from oauth2client<4.0.0,>=2.0.1->apache-beam)
Requirement already satisfied: pyasn1-modules>=0.0.5 in /usr/local/lib/python2.7/dist-packages (from oauth2client<4.0.0,>=2.0.1->apache-beam)
Requirement already satisfied: packaging>=16.8 in /usr/local/lib/python2.7/dist-packages (from setuptools->protobuf==3.2.0->apache-beam)
Requirement already satisfied: appdirs>=1.4.0 in /usr/local/lib/python2.7/dist-packages (from setuptools->protobuf==3.2.0->apache-beam)
Requirement already satisfied: pyparsing in /usr/local/lib/python2.7/dist-packages (from packaging>=16.8->setuptools->protobuf==3.2.0->apache-beam)
Installing collected packages: avro, protobuf, httplib2, oauth2client, apache-beam
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 784, in install
**kwargs
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 316, in clobber
ensure_dir(destdir)
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/utils/init.py", line 83, in ensure_dir
os.makedirs(path)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/avro-1.8.2.dist-info'
chuanman2707#transfer-learning-169510:~/cloudml-samples/flowers$
What should I do next? Thank you
If you look carefully at the line: OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/avro-1.8.2.dist-info', you'll see that you need sudo permissions.
Run the following:
sudo pip install apache-beam

Categories

Resources