pip-based system-wide environment

To configure a system-wide PyCUDA installation for Python, you can create a new project on PyCharm or change your system interpreter. Follow these steps to configure PyCharm to use the system-wide installation of Python:

  1. Create a new project in PyCharm:

  1. Instead of a Conda environment, we will now select the preinstalled system-wide Python installation on Ubuntu:

Once this environment has been created, you can now start using the user-specific system-wide PyCUDA installation on PyCharm:

PyCharm will still prefer to use the system-wide configuration if you want to go back to using your Conda-based PyCUDA projects that were set up within the virtual environment. To make PyCharm re-recognize the Conda-based PyCUDA package once again, you'll have to perform the following steps:

  1. First, go to Settings in the File menu:

  1. Now click on the gear symbol shown on the top-right area of the Settings window:

  1. Click on Show All:

  1. Select your project interpreter from the list and click on the icon that says Show paths for the selected interpreter when you hover over it using the mouse:

  1. Remove the user-specified path that PyCharm sees system-wide. Click OK:

  1. Hit OK once again in the Project Interpreters window. Finally, click on Apply in the Settings window for the changes to take effect.
  2. Now you can start using your Conda-specific local PyCUDA package once again:

If you wish to switch between the two, all you have to do is toggle between Python 3.6 /usr/bin/python3.6 and the Conda-based virtual environment in the system interpreter window:

We are now ready to begin computing with PyCUDA!