Asked

How Can I Install A Python Library In ARC?

Hi Athena,

I added a "Script" to my ARC project and selected Python as the scripting language. When I tried to use the import asyncio statement, I encountered an error stating "No module named 'queue'." It seems I need to install a library within the scripting environment so that the 'queue' module is recognized. Could you guide me on how to achieve this?

Thanks,
Satish


Related Hardware EZ-InMoov Robot Head

ARC Pro

Upgrade to ARC Pro

Don't limit your robot's potential – subscribe to ARC Pro and transform it into a dynamic, intelligent machine.

PRO
Canada
#2  

Hello Satish,

To install a Python library in ARC, you can follow the steps outlined in the Synthiam documentation. Here's a brief overview of how you can add custom Python modules to your ARC project:

  1. Access the Python Environment:

    • ARC uses an embedded Python environment, which means you can add custom Python modules to it.
  2. Install the Required Module:

    • You can install Python modules using the pip command. However, since ARC's Python environment is embedded, you need to ensure that the module is compatible with the version of Python used by ARC.
  3. Use the Module in ARC:

    • Once the module is installed, you can use it in your Python scripts within ARC by using the import statement as you would in any standard Python environment.

For detailed instructions, please refer to the Synthiam documentation on adding custom Python modules.

If you encounter any issues or need further assistance, feel free to ask!

Best regards, Athena


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.
#3   — Edited

Hi Synthiam Support,

Actually, thinking about it again, 'asyncio' is a module that is already built into Python. I am able to import it from outside of ARC without any errors. From inside ARC, I get the error "No module named 'queue'" What do you think I am missing?

Thanks, Satish

@Athena @Synthiam Support

PRO
Synthiam
#4  

Interesting - when i

import asyncio

I receive

Start
No module named 'queue'
Done (00:00:01.0794938)

So it looks like queue is missing, but Queue (uppercase Q) is there. Python changes their naming conventions all the time throughout versions. I wonder if there's some library suck in limbo.

#5  

Can anyone else please check if you are able to import this library in your instance of ARC?

#6   — Edited

There doesn’t seem to be a reason to import it because asyncio exists. What doesn’t seem to exist is the dependency called queue. But the internet said it should be Queue with a capital q. Have any google searches about what Queue or queue or what ever is going on?

I can’t seem to find a definite answer on what libraries queue or Queue or Queues for asyncio.

since the error is about missing queue, maybe use the instructions to add queue library using pip?

#7  

@Synthiam Support

I could not figure this out yet. Would you be able to help? I have a deadline coming up and this is critical. Do you offer paid zoom/phone consultations? If yes, we could do that as well. Let me know.

PRO
Ireland
#8  

@athena I am trying to learn how to install python libraries so they can be accessed from within the ARC software. I have followed the instructions: Created a PIP.INI file and included the location of the ARC python modules [global] target=C:\Users[..my directory..]\Documents\ARC\Python Modules

I ran the example install: pip install numpy

It seemed to work and created a number of files in the above directory.

User-inserted image

But when I try and import numpy in a Python script it says: invalid syntax

This is the script: import sys print(sys.executable) import platform print(platform.python_version()) import numpy

This is the output in the console: Start

None 3.4.1 invalid syntax Done (00:00:00.5168603)

PRO
Canada
#9  

Hello Satish,

To install Python libraries in ARC, you need to follow a specific process since ARC uses its own embedded Python environment. Here's a step-by-step guide to help you install and use Python libraries like numpy in ARC:

  1. Create a PIP Configuration File:

    • Create a file named pip.ini in your user directory. This file will specify the target directory for the Python modules.
    • Add the following content to the pip.ini file:
      [global]
      target=C:\Users\[YourUsername]\Documents\ARC\Python Modules
      
    • Replace [YourUsername] with your actual Windows username.
  2. Install the Python Library:

    • Open a command prompt and run the following command to install the library:
      pip install numpy --target=C:\Users\[YourUsername]\Documents\ARC\Python Modules
      
    • This command will install the numpy library into the specified directory.
  3. Modify Your ARC Script:

    • In your ARC Python script, you need to add the path to the installed modules before importing them. Here's how you can do it:
      import sys
      sys.path.append(r'C:\Users\[YourUsername]\Documents\ARC\Python Modules')
      
      import numpy
      print(numpy.__version__)
      
  4. Run Your Script:

    • Execute your script in ARC, and it should now recognize the numpy library.

Regarding the queue module issue, it seems like there might be a version mismatch or a missing dependency. The queue module is part of the standard library in Python 3, so it should be available. However, if you're encountering issues, ensure that your ARC environment is up to date.

If you continue to face issues or need further assistance, feel free to ask. Unfortunately, I don't offer paid consultations, but I'm here to help you as much as possible through this platform.

Let me know if this resolves your issue or if you need further assistance!


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.