https://prefect.io logo
Title
n

Nathaniel Russell

09/21/2022, 4:08 PM
I have been struggling to get past this error
File "C:\work\testing_service\sand02-cumulus-pipeline\service.py", line 7, in <module>
    from prefect.client import get_client
  File "C:\work\testing_service\sand02-cumulus-pipeline\prefect\__init__.py", line 24, in <module>
    from prefect.orion.schemas.states import State
  File "C:\work\testing_service\sand02-cumulus-pipeline\prefect\orion\schemas\__init__.py", line 1, in <module>
    from . import states, schedules, data, core, sorting, filters, responses, actions
  File "C:\work\testing_service\sand02-cumulus-pipeline\prefect\orion\schemas\states.py", line 14, in <module>
    from prefect.orion.schemas.data import DataDocument
  File "C:\work\testing_service\sand02-cumulus-pipeline\prefect\orion\schemas\data.py", line 8, in <module>
    from prefect.orion.utilities.schemas import PrefectBaseModel
  File "C:\work\testing_service\sand02-cumulus-pipeline\prefect\orion\utilities\schemas.py", line 12, in <module>
    import orjson
  File "C:\work\testing_service\sand02-cumulus-pipeline\orjson\__init__.py", line 1, in <module>
    from .orjson import *
ModuleNotFoundError: No module named 'orjson.orjson'
The extra weird thing is if I start python in anaconda prompt and simply try to import get_client or orjson it doesn't error, but running a python file it does.
2️⃣ 1
j

Jeff Hale

09/21/2022, 4:37 PM
Hi Nathaniel. Sounds like an environment configuration issue. Are you running the python file from a terminal where you are in a conda environment?
n

Nathaniel Russell

09/21/2022, 4:43 PM
ok, so the main place I have been seeing this error is from AWS lambda. when I run the file solo in my anaconda environment it doesn't error, and when I run it on anaconda from the folder that is going into the lambda it errors. however the folder structure of the lambda looks identical to my anaconda environment.
j

Jeff Hale

09/21/2022, 5:53 PM
Gotcha the lambda function needs access to the Python packages. Are those installed in the lambda environment? Also, here’s a guide that uses Lambda and more that you might find helpful.