This solved the issue for me:
The ModuleNotFoundError
for langtrace_python_sdk
in your CrewAI project indicates that the module isn’t accessible within the environment where CrewAI is running. To resolve this issue, follow these steps:
-
Add
langtrace_python_sdk
as a Dependency inpyproject.toml
:- Navigate to your CrewAI project’s directory.
- Open the
pyproject.toml
file. - Under the
[project]
section, addlangtrace_python_sdk
to thedependencies
list:[project] dependencies = [ "crewai[tools]>=0.95.0,<1.0.0", "langtrace_python_sdk>=3.3" ]
- Save the file.
-
Reinstall Project Dependencies:
- In the terminal, ensure you’re in your project’s root directory.
- Run the following command to install the updated dependencies:
crewai install
- This command will set up a virtual environment specific to your project and install all listed dependencies, including
langtrace_python_sdk
.
-
Verify the Installation:
- After the installation completes, run your project:
crewai run
- If the
ModuleNotFoundError
persists, ensure that thelangtrace_python_sdk
is correctly installed in the virtual environment.
- After the installation completes, run your project:
-
Manual Installation (if necessary):
- If issues continue, manually activate the virtual environment created by CrewAI:
source .venv/bin/activate
- Then, install the
langtrace_python_sdk
directly:pip install langtrace-python-sdk
- After installation, deactivate the virtual environment:
deactivate
- Retry running your project with
crewai run
.
- If issues continue, manually activate the virtual environment created by CrewAI:
By ensuring that langtrace_python_sdk
is listed as a dependency in your project’s pyproject.toml
and properly installed within the project’s virtual environment, CrewAI should recognize and import the module without issues.
For more detailed information, refer to the Langtrace AI documentation on integrating with CrewAI: Langtrace AI Docs.
If you encounter further difficulties, consider consulting the CrewAI community forums for additional support.