-
Notifications
You must be signed in to change notification settings - Fork 32
ModuleNotFoundError
The ModuleNotFoundError: No module named 'schnapsen'
occurs when the Python interpreter cannot find the Schnapsen package in your environment. This can happen if the package is not installed or if it is installed in the wrong environment. To resolve this issue, follow the steps below:
- Check if your Python version is compatible with the Schnapsen package (Python 3.10 or higher is recommended).
- Open your terminal or command prompt and run:
(Use
python --version
python3 --version
if you are specifically using Python 3). - If your version is lower than 3.10, you may need to upgrade your Python version.
Before cloning the repository from GitHub, ensure Git is installed on your system. Git is needed to clone repositories from GitHub.
- To check if Git is installed, run:
git --version
- If Git is not installed, download and install it from Git Downloads, following the installation instructions for your operating system.
Python virtual environments help manage dependencies specific to projects. Ensure you are working within the correct virtual environment where the Schnapsen package is installed.
-
Check if you are in an active virtual environment by looking at your terminal prompt. If you are inside a virtual environment, it will typically show its name, like
project_is
orvenv
. -
Example of an active virtual environment:
-
To activate a virtual environment:
-
On Linux/MacOS:
source venv/bin/activate
-
On Windows:
venv\Scripts\activate
- Replace
venv
with your environment's name (e.g.,project_is
if you followed the instructions on the Getting Started with the Schnapsen Platform page).
-
On Linux/MacOS:
-
If using Conda, activate the environment with:
conda activate [environment name]
- Clone the Schnapsen repository from GitHub to your local machine:
git clone https://github.com/intelligent-systems-course/schnapsen
- Navigate to the root directory of the cloned repository:
cd schnapsen
- Ensure you are inside the correct virtual environment and install the package in editable mode:
pip install -e .
- After installation, check that the
schnapsen
package is correctly installed by running:This command should return details about the installed package.python -m pip show schnapsen
- Sometimes, conflicts with other installed packages can cause issues. To check for dependency conflicts, run:
pip check
- If conflicts are found, you may need to upgrade or downgrade specific packages:
pip install [package]==[version]
- After following the above steps, try running your code again. Ensure that you are using the same terminal and virtual environment where the Schnapsen package was installed.
- If you continue to encounter issues, verify that your system’s PATH includes the Python executable and scripts directory:
-
On Linux/MacOS: Run
echo $PATH
-
On Windows: Run
echo %PATH%
-
On Linux/MacOS: Run
By following these steps, you should resolve the ModuleNotFoundError
and successfully run your code with the Schnapsen package.
Project Intelligent Systems - Vrije Universiteit Amsterdam