Global:
A public directory is available where instructors can install python packages for students to use. Once installed, these packages will be available for students and scripts to access in the course. There are some wrapper functions available to make this more convenient.
โ
This is done via the terminal in the "Configure workspace" window. If you are running Jupyter or R-Studio, you can get a terminal by selecting "View =>Standard". Depending on the python version, the instructor needs to use the appropriate function for packages installation:
vocpipinstall3.6 <pkgs>
vocpipinstall3.7 <pkgs>
vocpipinstall3.8 <pkgs>
The directories that these <pkgs> get installed in are already present in the PYTHONPATH for both teachers and students. Note that since all 3 python-version install paths are present in PYTHONPATH, if a pkg is installed for an unwanted version, it could get picked up for a different python version.
Update Package Version:
If you attempt to update an existing package version you may get this error message -
Installing collected packages: <pkg>
Attempting uninstall: <pkg>
Found existing installation: <pkg> <old-version>
Uninstalling <pkg> <old-version>:
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: 'WHEEL'
Consider using the `--user` option or check the permissions.
Trying using the --user option
pipinstall3.8 <pkg> --upgrade --user
or the --ignore-install option
pipinstall3.8 <pkg> --upgrade --ignore-install
Local:
Packages can also be installed in the local directories by students (or instructors). However, if the student code uses a package that was installed locally, it may not be available during grading (unless the instructor or Vocareum installs it in a globally visible location).
To install a package locally, just use the appropriate pip version and specify the "--user" switch.
pip3.6 install --user <pkg>
Packages can also be installed from within Jupyter notebooks. Since there are multiple python versions installed on the Vocareum servers, it is better to use the following command (instead of pip directly) so that the package is installed for the current notebook python version.
import sys
!{sys.executable} -m pip install --user <pkg>