-
Notifications
You must be signed in to change notification settings - Fork 28
Common errors
christyesmee edited this page Jan 3, 2024
·
3 revisions
This error indicates that the package itself is not installed (in the environemnt where this python is running). To resolve the ModuleNotFoundError: No module named 'schnapsen' error, follow these detailed steps:
-
Check Python Version:
- Open the terminal or command prompt.
- Check the installed Python version by executing
python --version
orpython3 --version
. - Ensure the Python version matches the requirement of the 'schnapsen' package (we recommend Python 3.9 for the best experience with the Schnapsen platform).
-
Check if Git is installed for the user
- Before you can clone the repository from GitHub, you need to ensure that Git is installed on your system. Git is a version control system used for tracking changes in source code during software development and is essential for cloning repositories.
- To check if Git is installed:
- Open your terminal or command prompt.
- Type
git --version
and press Enter. - If Git is installed, this command will return the version number of Git installed on your system. It should look something like
git version 2.x.x
. - If you get an error message or a message stating that Git is not recognized, it means Git is not installed on your system.
- In case Git is not installed, you will need to download and install it. You can download Git from https://git-scm.com/downloads. Follow the installation instructions provided on the website for your specific operating system.
-
Virtual Environment Check:
- Virtual environments in Python are isolated spaces used to manage Python packages for different projects. You need to ensure you are working in the correct virtual environment where 'schnapsen' is intended to be installed.
- To check if you are in an active virtual environment, look for its name in your terminal prompt. If you're not in a virtual environment, you won't see any specific name.
- This is an example of an active virtual environment
- To activate a virtual environment in a terminal, use source venv/bin/activate on Linux/MacOS or venv\Scripts\activate on Windows. Replace venv with your environment's name.
- If you're using Conda, use
conda activate [environment name]
.
-
Clone the Repository from GitHub:
- Go to the GitHub page where the 'schnapsen' repository is hosted.
- Clone the repository to your local machine. You can do this by using the command
git clone [repository URL]
. Replace [repository URL] with the actual URL of the repositoryhttps://github.com/intelligent-systems-course/schnapsen
.
-
Install the Package:
- Navigate to the root directory of the cloned 'schnapsen' repository in your terminal.
- Within this directory and in the active virtual environment, run
pip install -e .
. This command installs the package in 'editable' mode, which means any changes made to the source code will immediately affect the installed package.
-
Verify Package Installation:
- This error typically occurs when Python cannot locate the 'schnapsen' module in your environment. First, ensure that the 'schnapsen' package is indeed installed in the Python environment you're currently using.
-
Check for Dependency Conflicts:
- Sometimes, other installed packages may conflict with the dependencies of 'schnapsen'.
- Run
pip check
to see if there are any dependency conflicts. - If conflicts are found, you may need to upgrade or downgrade certain packages using
pip install [package]==[version]
.
-
Verify Installation:
- After installation, verify that the module is correctly installed by running
python -m pip show schnapsen
. - This command should return information about the 'schnapsen' package if it's installed properly.
- After installation, verify that the module is correctly installed by running
-
Reattempt Running Your Code:
- Once the above steps are completed, try running your code again. ** * Make sure you execute your Python script in the same terminal and virtual environment where you installed the 'schnapsen' package.**
-
Check System Path:
- If you continue to experience issues, check your system's PATH to ensure it includes the Python executable and scripts directory.
- In your terminal, you can print the PATH by running echo $PATH on Linux/MacOS or echo %PATH% on Windows.
Project Intelligent Systems - Vrije Universiteit Amsterdam