running into this error using a docker agent, the ...
# ask-community
j
running into this error using a docker agent, the task sometimes runs but other times I get this:
Copy code
Failed to load and execute Flow's environment: ModuleNotFoundError("No module named '/root/'")
k
Are you using DockerRun and LocalStorage?
What is your RunConfig and Storage?
j
This is the docker-compose.yml
Copy code
version: "3.7"

services:

    agent:
        build: .
        command: bash -c "prefect agent local start -t 7sm0QwSANd1uo0KD5To2fQ --label pwcm"
#        command: bash -c "prefect agent local start -t 7sm0QwSANd1uo0KD5To2fQ --label development"
        volumes:
            - /srv/docker/prefect/flows:/root/.prefect/flows
            - type: bind
              source: ./config.toml
              target: /root/.prefect/config.toml
              read_only: true

    client:
        build: .
        command: bash -c "python /worker/main.py && python /worker/uploadData.py"
        volumes:
            - /srv/docker/prefect/flows:/root/.prefect/flows
            - type: bind
              source: ./prefectPWCM/worker/main.py
              target: /worker/main.py
              read_only: true
            - type: bind
              source: ./prefectPWCM/worker/uploadData.py
              target: /worker/uploadData.py
              read_only: true
            - type: bind
              source: ./config.toml
              target: /root/.prefect/config.toml
              read_only: true
and the config.toml
Copy code
# debug mode
debug = true

# base configuration directory (typically you won't change this!)
home_dir = "~/.prefect"

backend = "cloud"
I was a bit confused by the docker storage docs, and on my PC I can run the scripts without it no problem. But one of my freelance clients is having issues. That error looks like something to do with the docker /root/ directory? But I have no imports from directories using a path.append. Everything is imported via packages, as you showed me a few weeks ago. Let me get a gist up so you can see the script
k
I think this error is related to path errors yeah. Or like the Python path.
j
It's still running locally on his Mac OS. I had tried to configure docker storage like so:
Copy code
# from prefect.storage import Docker

# storage = Docker(registry_url="<http://ghcr.io/chicago-joe/|ghcr.io/chicago-joe/>", image_name="pwcm", image_tag="0.1.0")
# storage.add_flow(weeklyPortfolioFlow)
# storage.add_flow(dailyTradingFlow)
# storage = storage.build()

# weeklyPortfolioFlow.storage = storage
# dailyTradingFlow.storage = storage
But I wasn't sure if that was necessary
k
You have my Github example of DockerRun + LocalStorage?
j
no I do not unfortunately, is that public? You had sent me some docs of building a custom python package that solved my path.append woes