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.
Related
I am trying to import a python module from a certain folder. This is the code:
import sys
sys.path.append(r"C:\path\to\module_foobar")
import foobar
In a miniconda env with all prerequisites installed (python 3.10 and numpy), I get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed while importing foobar: The specified procedure could not be found.
But with the system python in cmd, the same code works.
Tried adding the path to system path variable as well as specifying it in a custom .pth file in the site-packages folder of the miniconda environment.
Tried running dependencywalker on the .pyd file of the package and it says that a bunch of MS C++ Redistributeable dll files seem to be missing. Tried repairing those to no avail.
What on earth could be wrong?
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"
I have this error when running the script from terminal but works from PyCharm
C:\Users\Username\PycharmProjects\Space Invaders>python main.py
Traceback (most recent call last):
File "main.py", line 1, in <module>
import pygame
ModuleNotFoundError: No module named 'pygame'
This is how my file directory looks:
https://i.stack.imgur.com/s9qB5.png
I am using python 3.8 and pygame 2.0.1
Should I have to install pygame globally for me to run the script from command line? I have the package installed in a virtual environment.
You're trying to execute the script with global python which doesn't have the pygame package installed. So, you have to activate the virtual environment first. To do this, go to venv/Scripts/ and there will be an "activate" file that you need to execute. Once you have done this you can run your script and it should work.
More info on: https://docs.python.org/3/tutorial/venv.html
Emacs 24.5
Python 2.7.12
If I start simple (Hello world) python script from shell - is OK. But if start more difficult script then return error:
python myscript.py "some_params"
ATTENTION! https://pypi.python.org/pypi/names/ package is requred to randgen human names.
Run "sudo pip install names" to install.
Traceback (most recent call last):
File "myscript.py", line 6, in <module>
import secretary
File "my_another_script.py", line 5, in <module>
import names
ImportError: No module named names
You need to install the external libraries you are using. names in this case is an external library that you need to install to make your script work.
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?