ModuleNotFoundError: No module named 'project_name'

@rokbenko I’m using venv

python3 -m venv venv
source venv/bin/activate
pip install crewai yfinance

That’s all I do, and I don’t think I’ve changed anything in the environment, can you point out any specific things I should watch out for? What could be the reason? Thanks a lot!

Same issue. The project is working perfectly and after some dumb change, like adding memory to the crew (or honestly any other. I have experienced same error while changing empty lines in agents/task.yaml), the “crewai run” command gives this error about not finding the module named…

i also meet this problem, i create a project and run this project.

  • my problem
rewAI\my_project\.venv\Scripts\run_crew.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'my_project'
An error occurred while running the crew: Command '['uv', 'run', 'run_crew']' returned non-zero exit status 1.
  • base info:
    crewai version: 0.105.0
  • i run follow this sequence:
    crewai create crew my_project --skip_provider
    cd my_project
    crewai install
    crewai run

The same problem, please help to solve it.

Same issue for me too.
I don’t know enough about what crewai install and crewai run do behind the scenes.

But when we do the crewai install, it should build our projects and install that somewhere. In the .venv?

When we execute crewai run, it uses the TOML file to determine what crewai run should execute.

For my case, it is:
[project.scripts]
youtubesummerizer = “agents.main:run”
run_crew = “agents.main:run”
train = “agents.main:train”
replay = “agents.main:replay”
test = “agents.main:test”

When executing crewai run it fails with the error:
ModuleNotFoundError: No module named ‘agents’
An error occurred while running the crew: Command ‘[‘uv’, ‘run’, ‘run_crew’]’ returned non-zero exit status 1.

This is because based on the TOML it looks up the project.scripts and uses this line
run_crew = “agents.main:run”

agents.main is the namespace and run is the method in the main class it should execute.

For all of us, this first piece “agents” does not resolve correctly.

Anyone solve this?

Alternatively, I set up a .venv and execute my main.py class directly without using crewai to run it. I’d like to solve this so that I can test the training.

Yeah I am trying to figure this error out right now. Because it worked like a while ago but now it is not working

Has anyone found other solutions to this? I have encountered this problem a few times. I’m not exactly an expert in using this framework, as I have only been using it for a few weeks.

It appears that running “crewai run” within a virtual environment creates a new .venv folder at the root directory, which disrupts the entire stack.

My solution was to move the project_name folder out of src. Not sure why, but it solved the problem for me.