AutoGPT
AutoGPT copied to clipboard
ModuleNotFoundError: No module named 'shopify'
⚠️ Search for existing issues first ⚠️
- [X] I have searched the existing issues, and there is no existing issue for my problem
Which Operating System are you using?
MacOS
Which version of Auto-GPT are you using?
Master (branch)
GPT-3 or GPT-4?
GPT-3.5
Steps to reproduce 🕹
I'm currently working on building out a plugin to incorporate the Shopify_Python_API (shopifyapi) into AutoGPT. I've tried adding it to the requirements file and reinstalling them and I can't seem to get AutoGPT to recognize the module. Are there more steps I need to do to allow AutoGPT to recognize it as a module apart from it being already installed?
To reproduce:
Running on master branch:
Im executing the shopify_api.py in the workspaces folder from AutoGPT and keep getting the following error:
Executing file '/Auto-GPT/autogpt/auto_gpt_workspace/shopify_api.py'
Image 'python:3-alpine' found locally
SYSTEM: Command execute_python_file returned: Traceback (most recent call last): File "/workspace/shopify_api.py", line 3, in <module> import shopify ModuleNotFoundError: No module named 'shopify'
I've tried to work with this for almost 12 hours at this point, I'd like to turn it into a plugin for the git once I finish setting it up but I've ran into a wall with this error
#!/Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11
import shopify
import code
import sys
import os
import os.path
import glob
import subprocess
import functools
import yaml
import six
from six.moves import input, map
def start_interpreter(**variables):
# add the current working directory to the sys paths
sys.path.append(os.getcwd())
console = type("shopify " + shopify.version.VERSION, (code.InteractiveConsole, object), {})
import readline
console(variables).interact()
Current behavior 😯
NEXT ACTION: COMMAND = execute_python_file ARGUMENTS = {'filename': '/Auto-GPT/autogpt/auto_gpt_workspace/shopify_api.py'}
Enter 'y' to authorise command, 'y -N' to run N continuous commands, 's' to run self-feedback commands'n' to exit program, or enter feedback for ...
Asking user viay -=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-=
Executing file '/Auto-GPT/autogpt/auto_gpt_workspace/shopify_api.py'
Image 'python:3-alpine' found locally
SYSTEM: Command execute_python_file returned: Traceback (most recent call last): File "/workspace/shopify_api.py", line 3, in <module> import shopify ModuleNotFoundError: No module named 'shopify'
more here: https://significant-gravitas.github.io/Auto-GPT/setup/#getting-an-api-key
THOUGHTS: It looks like the 'shopify' module is not installed. We can use the 'google' command to search for instructions on how to install the 'shopify' module.
NEXT ACTION: COMMAND = execute_python_file ARGUMENTS = {'filename': '/Auto-GPT/autogpt/auto_gpt_workspace/check_python_version.py'}
Enter 'y' to authorise command, 'y -N' to run N continuous commands, 's' to run self-feedback commands'n' to exit program, or enter feedback for ...
Asking user via keyboard...
Input:y
-=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-=
Executing file '/Auto-GPT/autogpt/auto_gpt_workspace/check_python_version.py'
Image 'python:3-alpine' found locally
SYSTEM: Command execute_python_file returned: Python 3.11.3
THOUGHTS: Now that we know the version of Python that AutoGPT is running on, we can proceed with installing the 'shopify' module using the appropriate command for the version of Python.
REASONING: Knowing the version of Python that AutoGPT is running on will allow us to use the appropriate command to install the 'shopify' module and ensure that it is compatible with the version of Python we are using.
PLAN:
- Use the appropriate command to install the 'shopify' module for the version of Python that AutoGPT is running on
CRITICISM: I need to make sure that I am using the correct command to install the 'shopify' module and that it is compatible with the version of Python we are using.
NEXT ACTION: COMMAND = execute_python_file ARGUMENTS = {'filename': '/Auto-GPT/autogpt/auto_gpt_workspace/install_shopify_module.py'}
Expected behavior 🤔
I'd expect it to import the module but I'm thinking because its not one of the original requirements It won't recognize it as a module. It works locally just fine so I know the Shopify installation worked on my computer, it's just not recognized by AutoGPT. This is how it responds on my local machine.
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
(base) Ethans-MBP-4:~ $ shopify_api.py console
using livingelevated.myshopify.com
Python 3.11.3 (v3.11.3:f3909b8bc8, Apr 4 2023, 20:12:10) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(shopify 12.3.0)
>>> help(object)
Help on class object in module builtins:
class object
| The base class of the class hierarchy.
|
| When called, it accepts no arguments and returns a new featureless
| instance that has no instance attributes and cannot be given any.
|
| Built-in subclasses:
| anext_awaitable
| async_generator
| async_generator_asend
| async_generator_athrow
| ... and 88 other subclasses
|
| Methods defined here:
|
| __delattr__(self, name, /)
| Implement delattr(self, name).
|
| __dir__(self, /)
| Default dir() implementation.
|
| __eq__(self, value, /)
| Return self==value.
|
| __format__(self, format_spec, /)
| Default object formatter.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getstate__(self, /)
| Helper for pickle.
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __le__(self, value, /)
| Return self<=value.
|
| __lt__(self, value, /)
| Return self<value.
|
Your prompt 📝
No response
Your Logs 📒
No response
This is a limitation of execute_python_file, it runs the file in a Docker container so it is encapsulated from the host environment.
I have a script which uses pip on the alpine docker container (mostly copy-pasted from the execute_python_file function, but using the command "python -m pip install -U {package}"), and it looks like pip is being called successfully, but the code still doesn't seem to work. Is that also an expected consequence of the Docker container?
...
Command import_python_package returned: Collecting pdfkit Downloading pdfkit-1.0.0-py3-none-any.whl (12 kB) Installing collected packages: pdfkit Successfully installed pdfkit-1.0.0
...
...
Image 'python:3-alpine' found locally
SYSTEM: Command execute_python_file returned: Traceback (most recent call last): File "/workspace/convert_to_pdf.py", line 1, in <module> import pdfkit ModuleNotFoundError: No module named 'pdfkit'
...
@k-boikov how can i add modules that do not exist in the container? It keeps going in loop of pip install <moduleName> to <moduleName> not found.
This is a limitation of execute_python_file, it runs the file in a Docker container so it is encapsulated from the host environment.
@k-boikov
is there any solution for this problem ?
This issue has automatically been marked as stale because it has not had any activity in the last 50 days. You can unstale it by commenting or removing the label. Otherwise, this issue will be closed in 10 days.
This issue was closed automatically because it has been stale for 10 days with no activity.