In a typical workflow, each PyCharm project will have an associated virtual Python environment (venv). The gurobipy package must be available to the Python interpreter of that venv. Installing gurobipy into your project's virtual environment should be done via pip.
- Open a terminal window from within PyCharm, using the button in the IDE's bottom-left corner
- Within this terminal window, run python -m pip install gurobipy
See Using pip to Install the Gurobi for Python Interface for more details about the pip installation.
How do I resolve the error "Process finished with exit code 137 (interrupted by signal: SIGKILL)"?
The exit code 137 generally means that your process was killed manually or by your OS. If you have not manually stopped your process, your OS killed the process likely because of high memory usage. If the killed process was a Gurobi process, you can use some of the strategies proposed in the article How do I avoid an out-of-memory condition? to manage the memory used by the Gurobi process.
In case you see this error on a macOS with Apple M1 chip when running your first program after the installation, make sure to choose python3 as the Base interpreter in the "Create Project" window when initializing your PyCharm project.