In a typical workflow, each PyCharm project will have a virtual environment (venv) associated with it. The gurobipy package must be available to the python interpreter of that venv. Please use the pip install method as explained in the documentation. In case that fails, proceed as follows:
- Install the full version of Gurobi Optimizer.
- Go to a terminal window from within PyCharm, using the button at the bottom left.
- In this terminal window, go to Gurobi's installation folder (GUROBI_HOME) and run python setup.py install.
(venv) $ which python
(venv) $ cd /Library/gurobi910/mac64/
(venv) $ python setup.py install
Note for Linux users: In case you get an error like this when trying to import gurobipy
ImportError: libgurobi**.so: cannot open shared object file: No such file or directory
please set the LD_LIBRARY_PATH environment variable in PyCharm to point to the lib subdirectory in your Gurobi installation directory (GUROBI_HOME).