pythonmysqlpython-3.xhadoopsqoop

Pycharm doesn't recognise Sqoop libraries


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?


Solution

  • 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"