I tried to run a python script on my local machine. Apparently this script stops and throws an error with message "no named module graphql". I tried to do python -m pip install graphql and it also fails with error message "Don't know how to compile graphql/graphql_ext.pyx". A screenshot of the entire error is shown below.
The script and commands are ran with the PowerShell
I use a windows machine
I use Python version "3.10.7"
Related
I am trying to run a python script to pull a table from MariaDB. I can run it locally on the MariaDB I installed on my device but when I go to run it on my vm it throws the ModuleNotFoundError. If I run 'pip-safe list' it shows both modules are there but when I run the script I get the error above. I have also tried moving the location that the modules are stored to see if it was a directory issue. I think that it's simply an issue with the import syntax with the '.' in mysql.connector but I can't figure out why. If anyone could help me troubleshoot this that would be greatly appreciated.
Code
Error Message
"pip-safe" was installing the modules to a virtualenv within my system. Where as "sudo pip3" would install to a different directory. When I installed mysql-connector-python via "sudo pip3" and ran the same script I didn't get any errors.
I still don't fully understand why python3 wasn't able to find the modules that were istalled via "pip-safe" but the script is working.
I'm trying to connect the Bybit websocket to Python via this code.
from BybitWebsocket import BybitWebsocket
ws = BybitWebsocket(wsURL="wss://stream-testnet.bybit.com/realtime",
api_key=None, api_secret=None)
ws.subscribe_instrument_info(symbol="BTCUSD")
while True:
data = ws.get_data("instrument_info.100ms.BTCUSD")
if data:
print(data)
I'm new to Python and websockets so I have no idea why this does not work. I have already pip installed the websocket with the command:
pip install bybit-ws. I get the error: "ModuleNotFoundError: No module named 'BybitWebsocket'". It has probably to do something with a path, but I still can't fix it. Any help?
install bybit-ws is the correct command to install the module you are looking to import, but to make sure that your module is being installed within the correct Python environment, perform:
pip3 install bybit-ws
And then run your code. You might otherwise be well installing it into the system Python (likely Python2, if you are on OSX).
You can check that the module is importable in Python3 if you open a Terminal window and type in:
python3
from BybitWebsocket import BybitWebsocket
If the above succeeds, your import will work if you run it from the Terminal with:
python3 path/to/your/script.py
But if you still get the ModuleNotFound error when you run it from your IDE, then your IDE is configured to execute code within the wrong environment.
On a windows 7 (64-bits) machine I installed python 2.7.
Then installed pyinstaller, pypiwin32, pywin32-ctypes in this order, by running "pip install pyinstaller" etc in command prompt. Each time some files were downloaded and a success message was shown.
Then I restarted my computer.
After doing above, I ran "pyinstaller" in command prompt (just this, didnt mention the python code file I wrote) to test the installions.
I get a detailed error message, whose last line is shown below (the whole error message is I think too cumbersome and unnecessary to be shown here):
C:\Python27>pyinstaller
ImportError: No module named dis3
Same error came when I ran the command from c:\python27, c:\python27\scripts.
Same error also came when I ran the command mentioning my python code file from above directories and also from the directory where my python code file is.
The other questions here related to import errors mentioning some modules when running pyinstaller command are about programming errors inside users' codes such as not mentioning a module in import statement because of hidden dependency etc. I think my error is related to installation (because as stated above, even when I dont pass my code file to the command same error comes).
Is the problem with installion or with my code?
If the problem is with installion, what do I need to install or uninstall, and in which order?
If the problem is in my code then what do I have to import?
dis3 is not a dependency of pyinstaller. You must install it via pip install dis3.
This is needed only if you're trying to "pyinstall" a bunch of code written in python 2.7
I am trying to work on a lab machine using Python scripts that run fine on my local machine. The scripts were written for Python 2.7, and use the AARDVARK device library as an imported module.
The script runs on Windows' command shell, but fail to run on the installed Cygwin bash shell. The PYTHONPATH variable is defined correctly and similar to my local machine. When running, it complains that it cannot fin the AARDVARK module. So, following this question, I added the sys.path.append('/cygdrive/c/aardvark') command to my script.
Now, when I try running it, I get a pop-up message window saying Unable to bind Python API. API supports Python 2.3,2.4,2.5,2.6,2.7. Running python --version on the bash command line, I get 2.6.7.
What is this error message and how to eliminate it?
How can I make the script run and use the aardvark module?
I have installed the K4W branch of the open kinect project on Linux 11.10 from https://github.com/renewagner/libfreenect/tree/k4w-wip . I can navigate to the directory libfreenect/build and run the command:
sudo bin/glview
and the output works correctly.
I have also installed the Python wrappers from libfreenect/wrappers/python and I can import the libraries successfully. However if I run a simple code such as
import freenect
freenect.sync_get_depth()
Which I saved as kinect1.py and then ran using the command sudo kinect1.py
I get the following error:
Error: Invalid Index[0]
Error: Can't open device 1.) Is it plugged in? 2.) Read README
However, I can go straight back to running the glview example and it still work find. So I must be missing something with the Python wrapper implementation. I hope someone can help.