Pycharm doesn't recognise Sqoop libraries - python

I am on Pycharm trying to use Sqoop import job to load MySQL data in to HDFS.
I downloaded this package on terminal
pip install pysqoop
I tried running this package
from pysqoop.SqoopImport import Sqoop
sqoop = Sqoop(help=True)
code = sqoop.perform_import()
This was the error
/home/amel/PycharmProjects/pythonProject/venv/bin/python /home/amel/PycharmProjects/pythonProject/Hello.py
Traceback (most recent call last): File "/home/amel/PycharmProjects/pythonProject/Hello.py", line 1, in <module>
from pysqoop.SqoopImport import Sqoop ModuleNotFoundError: No module named 'pysqoop'
Process finished with exit code 1
How can I solve this problem?

There is an option that your python code is running in a different python environment than your main one go to pycharm file->settings->project->project-interpreter. Than change your env.
OR
put your cursor on pysqoop and press alt+enter and choose "install package pysqoop"

Related

How to add additional libraries in ExecuteStreamCommand in Nifi?

I'm not able to run a Python script from ExecuteStreamCommand.
These are the processor properties:
Command arguments: /home/directory/test.py
Command path: /bin/python3
Working directory: /home/directory
Error message: Traceback (most recent call last): File "/home/test.py", line 1, in import nipyapi ModuleNotFoundError: No module named 'nipyapi'
The way that I am able to get ExecuteStreamCommand processor to run python scripts with imported modules is to install the imported modules on the actual machine itself. Therefore, this means running pip or pip3 install {insert module name} on the command prompt for each system that this processor is running on.

paraview-python: Could not import vtkCommonComputationalGeometry

I try to run a python script (test.py) containing this line only:
from paraview.simple import *
I want to use the last version of paraview. So, I downloaded it from the official webpage and I uncompressed the corresponding archive into a folder, say /home/paraview.
If I do not anything more than running the script with
python test.py
I get the following error message:
Traceback (most recent call last):
File "test.py", line 2, in <module>
from paraview.simple import *
ModuleNotFoundError: No module named 'paraview'
So, I set my PYTHONPATH like this:
export PYTHONPATH=/home/paraview/lib/python2.7/site-packages:$PYTHONPATH
Then, I rerun my script and I get a different error message:
Error: Could not import vtkCommonComputationalGeometry
Segmentation fault
I tried to set LD_LIBRARY_PATH:
export LD_LIBRARY_PATH=/home/paraview/lib
where vtkCommonComputationalGeometry.so is but it does not work.
Furthermore, if I try to locate vtkCommonComputationalGeometry, I find it in another location:
/usr/lib/x86_64-linux-gnu/libvtkCommonComputationalGeometry-6.2.so
I removed vtk with apt but it is still here.
Do you know how I could run my script?
Just use pvpython, that can be found in ParaView binaries.
path/to/ParaView/bin/pvpython test.py
try to install PVGeo package.
pip install PVGeo

ModuleNotFoundError: No module named 'bayesnet'

I'm trying to use the OpenBayes module, but the problems start from the very first step :'(
When I try to import from OpenBayes
I get:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Мари\AppData\Local\Programs\Python\Python36\lib\site-packages\OpenBayes\__init__.py", line 7, in <module>
from bayesnet import *
ModuleNotFoundError: No module named 'bayesnet'
UPD: While installing (from .exe file) for py2 i gor error: "could not set a key value" (not a python error, but in dialog window)
I tried using pip install from console, but still get errors there.
Command "python setup.py egg_info" failed with error code 1 in C:\Users\CD3B~1\AppData\Local\Temp\pip-build-m4nnwa4o\OpenBayes\
Also not sure which py (2 or 3) is used when i type a command from console(
(Sorry for all that stupis questions)
You should
from OpenBayes import *
or
from OpenBayes import BNet
Here is an example demonstrating it's usage:
https://github.com/willasaywhat/OpenBayes-Fork/blob/master/Examples/bn_asia.py
I had the same problem and I created a directory with the same name as the root folder (within the root folder). Python then referred Its import calls to the src directory and not the folder. I also changed the python interpreter to a virtual (anaconda.exe), as the python install did not contain many of the modules that were being called by the application (flask, etc)
It's a weird workaround, but it worked for me. Hope this helps

CentOS Python multiple interpreters issue - incorrect shebang

I'm trying to run a Python script (testing.py) as a cron job. I have CentOS with a separate python2.7 interpreter path, so I've added the following shebang:
#!/usr/local/bin/python2.7
However, when the cron job runs I get the following error
Traceback (most recent call last):
File "/root/carsales/carsales_v2.py", line 3, in <module>
import pandas as pd
ImportError: No module named pandas
I have installed Anaconda, and if I run the python2.7 interpreter through the command line, as:
python2.7 testing.py
It imports pandas successfully. However, running it directly (as per below) fails to import:
./testing.py
So there's some problem with the shebang, or possibly with the Anaconda install?

Error during library import in Python (Windows)

I am trying to configure svn hook for email notification using mailer.py script from apache, but it always crash on import of svn libs. I try two ways of installing svn and python. I try to install everything manually using command line and use CollableNet installer that have preinstalled Python and all libs I need but result is the same.
Now I try to import one library from hole package that I need using python in command line and I have such response:
>>> import svn.core
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named svn.core
I try to fix it using:
1) import sys; sys.path.append("C:\csvn\lib\svn-python\svn")
and
2) C:\csvn\lib\svn-python\svn>python "\__init__.py" install
But it didn't help.
For now I have no package with setup.py to install it.
I spend a lot of time on this task, and going crazy a little). Please give me any suggestion how to fix it.

Categories

Resources