Asked — Edited

Installing Python Modules

I tried following the instructions at https://synthiam.com/Support/python-api/add-custom-python-modules but ran into issues so I uninstalled ARC and reinstalled. So starting fresh, I just want to try getting numpy available to my script. I created a new python script in ARC as follows: import sys print(sys.version) print(sys.executable) import numpy

I get the following output:

User-inserted image

The import and calls to SYS work (even though executable is empty for some reason), but I would expect to see something along the line of "module not found" for the numpy import. Why am I seeing the above error and what does it mean here?

Thanks Oisin



Related Hardware (view all EZB hardware)
EZ-B V4 by EZ-Robot
EZ-B v4/2 robot controller: dual Cortex ARM, Wi-Fi, audio/video, 24 servo/digital ports, I2C/UART, camera and Synthiam ARC control for custom robots
Wi-Fi / USB
Servos 24
Camera
Audio
UART 3
I2C
ADC 8
Digital 24

ARC Pro

Upgrade to ARC Pro

Subscribe to ARC Pro, and your robot will become a canvas for your imagination, limited only by your creativity.

#1   — Edited

Just as an fyi, the screenshot you posted can't be read by Athena AI. You'd have to provide a copy and paste in text. In addition, you have not posted example code. Please provide information, such as the code you're executing and the steps you took to get there

#2   — Edited

I did but your webpage squashed it all up into the following line:  import sys print(sys.version) print(sys.executable) import numpy

Further to this I note that the command "add_dll_directory" only came in in python 3.8, so why do I see it here in ARC's version 3.4?

Author Avatar
PRO
Canada
Twitter YouTube GitHub
#3  

It seems like you're encountering an issue with importing the numpy module in ARC's Python scripting environment. Let's address your concerns step by step:

  1. Python Version in ARC: ARC uses a specific version of Python that might not support all the latest features or modules. The add_dll_directory function is indeed available from Python 3.8 onwards, and if ARC is using Python 3.4, this function won't be available.

  2. Installing Python Modules in ARC: To use external Python modules like numpy in ARC, you need to ensure that the module is installed in the Python environment that ARC uses. Here’s a general approach to do that:

    • Locate ARC's Python Environment: You need to find out where ARC's Python environment is located. This can sometimes be tricky if the sys.executable is not providing the path.
    • Install the Module: Once you have the path, you can use a command prompt to navigate to that directory and use pip to install numpy. For example:
      cd path\to\arc\python
      pip install numpy
      
  3. Troubleshooting:

    • Check Python Path: If sys.executable is empty, it might indicate an issue with how ARC is configured to use Python. Ensure that ARC is correctly set up to use its Python environment.
    • Error Messages: If you encounter specific error messages when trying to import numpy, please share them here. They can provide more insight into what might be going wrong.
  4. Alternative Solutions:

    • Use JavaScript: If Python is proving too problematic, consider using JavaScript for your scripting needs in ARC. JavaScript is well-supported and might offer a smoother experience.

If you continue to face issues, please provide any error messages or additional details, and I'll be happy to assist further!


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
#4   — Edited

So I think I have the following issue happening: I try import numpy and it tells me "No module named 'numpy'". All good.

I run the following install: pip install numpy --target="C:\Users\oisin\Documents\ARC\Python Modules"

It installs numpy version 2.3.1 in the above directory. When I try import it in a script I get "invalid syntax". I am assuming that this is because ARC uses Python 3.4.1 for which I would need an earlier version of numpy?

So I deleted the files from "Python Modules" and tried the following install: pip install numpy==1.16.0 --target="C:\Users\oisin\Documents\ARC\Python Modules" But this generates errors and does not install. This might be because I have Python 3.10.10 installed on my machine. Does all this make sense and if so do I have to downgrade my machine to 3.4.1 and then run the installs?