Issues with Python tabula-py, error "unknown location" - python

I installed tabula-py using pip install, and importing it gave no errors.
I also made sure JAVA was added to PATH (environment variable).
However, when I try to run:
from tabula import read_pdf
I get the error:
ImportError: cannot import name 'read_pdf' from 'tabula' (unknown location)
Any ideas on how to proceed from here?
I am using Pycharm if that helps.

First you need to give a file name to java/python argument.
You can locate your file by commanding
find . -name
and type cd and drag your file where your Pycharm project is at
so that it automatically gives you the file name after cd. like
ex)) cd /User/wasabi/PycharmProjects/pythonsample2/
and after you command terminal to start using your JAVA/Python/ whatever, you can do
from tabula import read_pdf
I'm not an expert, but I solved the issue like yours in this way.

You don't need the parentheses on the import command
from tabula import read_pdf

Related

ImportError: cannot import name 'YamlModel' from 'pydantic_yaml'

I am working at blender script, where I want to use YAML. So I try to import it:
from pydantic import BaseModel
from pydantic_yaml import YamlModel
But when I run my script, this error will occure:
ImportError: cannot import name 'YamlModel' from 'pydantic_yaml' (C:\Program Files\Blender Foundation\Blender 3.0\3.0\python\lib\site-packages\pydantic_yaml\__init__.py)
I have installed pydantic and pydantic_yaml on both Pythons (Blender one and the common one), if they wouldn't be installed, there would be different error. I tried googling, but google had very few results for this problem. Also, when I open that __init__.py file, there is clearly YamlModel. Thank you for any kind of help.
I found the same error and it is related how pydantic-yaml got installed.
There is a bug in the package. you need to install optional dependencies as well (so called extras).
pip install pedantic-yaml[pyyaml,ruamel]
or manually install pyyaml ruamel please make sure that that Taumel version is <=0.18

ImportError: cannot import name 'EXTRACTOR_FILENAME' from 'talon.signature'

I am having trouble getting an import statement to work. I am attempting to use this package:
https://github.com/mailgun/talon
I am running the following command:
from talon.signature import EXTRACTOR_FILENAME, EXTRACTOR_DATA
I get the following error:
ImportError: cannot import name 'EXTRACTOR_FILENAME' from 'talon.signature' (system path to file)
While troubleshooting I don't see EXTRACTOR_FILENAME or EXTRACTOR_DATA defined anywhere. I did a search in directory for all files. Is there some sort of convention in python where EXTRACTOR_FILENAME maps to a specific class?
UPDATE: Figured it out, just something as simple as manually defining the 2 constants. The docs weren't exactly clear or I missed it.
For your project the import looks like this:
import talon
from talon import quotations
Put those statements on the top of your file, and it should work.
if you don't have the packages on your system type this in your terminal:
pip install talon
The Github repo also explains this

Unable to import light-curve in sunpy

I am trying to import 'lightcurve' in sunpy. But unfortunately got an error
cannot import name 'lightcurve'
How can I resolve this issue?
first make sure the module is installed, open the command line (search cmd in start menu) then type
pip install lightcurve
Or if your on Linux open the terminal and type
sudo apt-get install python
then import the module like this into your code
import lightcurve
sunpy removed the lightcurve submodule and it was replaced with "timeseries".
An example of this is here: https://docs.sunpy.org/en/stable/generated/gallery/time_series/goes_hek_m25.html#sphx-glr-generated-gallery-time-series-goes-hek-m25-py
I would suggest that if you found a example or resource that uses lightcurve that is very old, that it is out of date and is fit for use.
The latest documentation is https://docs.sunpy.org/en/stable/

How to know the package or module name from import statement in Python?

I have a python file and the developer of that code has left the organization. When I run the code I get the following error.
import dataAnalysis as DV ModuleNotFoundError: No module named
'dataAnalysis'
I provide below the brief snippet of the python file "main.py" below.
import dataAnalysis as DV
def performCheck():
... other code
... other code
i = DV.addGraph( pathplus)
Here my question is , how to know the actual module or package name of "dataAnalysis" from the above import statement so that I can make "pip install ". However, I tried to install DataAnalysis module, still it does not work.
Is there any way to get the module or package name to install from the import statement in python ?
Go to console or terminal and run command pip install dataAnalysis. If permission denied, then make sure you have enough privilege to install a package.
Update:
In my opinion pip package DataAnalysis is a library that can be used for pre-processing a csv file. As per your given code, it looks like adding a graph so may be it could be a local package. Check dataAnalysis folder in your project with __init__.py file inside.

Unable to import libraries in Python

Yesterday, I accidentally deleted the Path variable but I think I restored them. I added Python path to it and I've got my python running through command prompt and also pip is working. However, I'm unable to import new modules to Python shell.
It comes up with the following error
enter code here
File "<pyshell#1>", line 1, in <module>
import wxPython
ModuleNotFoundError: No module named 'wxPython'
Any suggestions as to what I'm missing? Maybe I didn't add the Path correctly?
here is what I have added
%SystemRoot%\system32;
%SystemRoot%;
%SystemRoot%\System32\Wbem;
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;
C:\Program Files\Common Files\Oracle\Java\javapath;
C:\Users\user1\AppData\Local\Programs\Python\Python36-32\Scripts;
C:\Users\user1\AppData\Local\Programs\Python\Python36-32;
C:\Users\user1\AppData\Local\Programs\Python
Also add C:\Users\<your user>\AppData\Local\Programs\Python\Python36-32\Libs; to your path

Categories

Resources