FAQ

Can I use objects in Code Workspaces?

It is not currently possible to use objects directly in Code Workspaces. User may import datasets that back objects using the Data menu within a workspace.

Can I use PySpark in Code Workspaces?

Yes, PySpark is available for use in Code Workspaces, but note that it will not leverage a distributed Spark infrastructure since Code Workspaces currently run on a single node. We recommend Foundry applications like Pipeline Builder and Code Repositories if you want to leverage a Spark infrastructure.

To install PySpark in your JupyterLab® Notebook, go to the Packages tab, and search and install openjdk (from Conda) and pyspark (from PyPI).

Install openjdk

Install pyspark

Which IDEs are supported by Code Workspaces?

Code Workspaces currently supports JupyterLab® and RStudio® Workbench.

Which packages are not supported by Code Workspaces?

Due to security reasons, the following Python packages are not supported:

  • folium
  • pandasgui

Contact your Palantir representative if you have any concerns about the packages above.

Can I make API calls in Code Workspaces?

Yes, you can make API calls in Code Workspaces after defining network policies in the Settings menu. Note that the external API must be registered as an approved Network Egress policy in Control Panel.

Network policies panel

Why does the code in my repository have JSON formatting?

The Code Repositories application receives code from associated Code Workspaces in an IPython format, which renders the code at a cell-by-cell level in JSON format.

Can I use my own packages?

Yes; see the documentation on importing packages. If your package is hosted on an organizational Conda/PyPI/CRAN channel, it is possible for Foundry to proxy the channel and make it available to your projects. Contact your Palantir representative for more information.

Why does the Code Repository backing my Code Workspace not have a Libraries tab?

To import libraries into your Code Workspace, use the Packages tab located in the left panel of your workspace.

Can I write or edit code in Code Repositories that does not come from my Code Workspace?

Yes, you can edit code directly in Code Repositories when the code originates in Code Workspaces. Once committed, you can use the Sync or Reset changes functionality in the Code Workspace to pick up the remote changes in the Workspace.

Conceptually, you can think of Code Repositories as the version control manager for Code Workspaces, handling pull requests, conflict resolution, and administration, while code development can occur in Code Workspaces.

Why do my colleagues see a different view compared to mine?

For security purposes, users are isolated when working in JupyterLab® or RStudio®. This means each user accessing the same Code Workspace will have their own environment. Collaboration happens through git workflows: if you wish to make your latest code available to colleagues, select Sync Changes to synchronize your changes with the backing code repository and the changes will become available to your colleagues when they select Sync or Reset changes. When multiple users work on the same workspace, we recommend they work on independent branches.

Note that we ignore some files by default using .gitignore to ensure that no data is synchronized with the git repository, and to limit the size of the git repository. We also remove all outputs from JupyterLab® .ipynb files.

Can I import extra LaTeX packages to render my R Markdown file?

Yes. By default, Code Workspaces only pre-installs the requirements to render common R Markdown files (as defined in TinyTex-1 ↗), but you can install other LaTeX packages on your own:

  1. Download or create the TDS archive. For instance, you can download a .tds.zip file from CTAN ↗.
  2. Upload the TDS archives to a new or existing Foundry dataset. You can drag and drop files in a folder to upload them to a new Foundry dataset.
  3. Select Upload to a dataset without a schema. You may upload multiple TDS archives simultaneously to the same dataset.
  4. In Code Workspaces, go to the Data tab, then Read existing datasets. Select the dataset containing the TDS archives.
  5. Optionally, update the dataset alias. In this example, we assume you named your dataset alias my_latex_packages.
  6. Copy the code snippet, paste it in your .Rprofile, and update it to also extract the files to the correct location. You will need to replace my_latex_packages with your dataset alias in the below snippet:
library(foundry)
my_latex_packages_files <- datasets.list_files("my_latex_packages")
my_latex_packages_local_files <- datasets.download_files("my_latex_packages", my_latex_packages_files)
texmflocal <- system("kpsewhich --var-value TEXMFLOCAL", intern = TRUE)
sapply(my_latex_packages_local_files, function(tds_file) { unzip(tds_file, exdir = texmflocal) })
  1. You can now include your package in the R Markdown header to use it:
headers-include:
 - \usepackage{my_package}

Can I use custom fonts in my R Markdown file?

Yes.

  1. Download or create the TTF files you want to use.
  2. Upload the TTF files to a new or existing Foundry dataset. You can drag and drop files in a folder to upload them to a new Foundry dataset.
  3. Select Upload to a dataset without a schema. You may upload multiple TTF files simultaneously to the same dataset.
  4. In Code Workspaces, go to the Data tab, then Read existing datasets. Select the dataset containing the TTF files.
  5. Optionally, update the dataset alias. In this example, we assume you named your dataset alias my_fonts.
  6. Copy the code snippet, run it in the R Console, and copy the files to your repo so they can be tracked by the version control. You will need to replace my_fonts with your dataset alias in the below snippet:
my_fonts_files <- datasets.list_files("my_fonts")
my_fonts_local_files <- datasets.download_files("my_fonts", my_fonts_files)
dir.create("fonts")
file.copy(unlist(my_fonts_local_files), "fonts")
  1. You can now reference the fonts in the /home/user/repo/fonts directory so they can be used in your HTML or PDF outputs following the R Markdown recommendations.

To change the font for HTML, set the font-family in a custom CSS ↗.

To change the font for PDFs, you can load the font in LaTeX with \newfontfamily using custom LaTeX code ↗ in the preamble.

How can I prevent my Jupyter® workspace from pausing while my code is running?

You can leverage the %%keep_alive cell magic to prevent Code Workspaces from pausing a Jupyter® notebook while the code in the cell is running.

Copied!
1 2 3 %%keep_alive long_running_process()

This will keep the cell alive for up to 24 hours while the cell code is running. If your browser tab is closed or left idle for too long, JupyterLab® will stop displaying and persisting the cell's output. If you would like to view the cell's output later, you may use the %%capture cell magic to store the output in a variable:

Copied!
1 2 3 4 %%keep_alive %%capture cell_output long_running_process()

In a different cell, write the output of the above variable to a file so it can be viewed later:

Copied!
1 2 3 with open('cell_output.txt', 'w+') as f: f.write(cell_output.stdout) f.write(cell_output.stderr)

How can I download files from my Jupyter or RStudio Code Workspace?

The IDE native file downloads are disabled in the Palantir platform to ensure that download restrictions configured by administrators are enforced.

In order to download files, write the files back to a Foundry dataset. To do so, in the Code Workspaces sidebar, navigate to the Data tab, then Write data to new dataset, and enter a name for the new dataset. After confirming the alias for the dataset, select Non-tabular dataset as dataset type, enter the location of the files or directory you wish to upload and run the generated code snippet.

Once the files have been uploaded to the Foundry dataset, you can navigate to the dataset preview by selecting on the dataset link and download the files from there. Remember that your administrator may require a justification before exporting data from the platform or limit the amount of data exported.


RStudio® and Shiny® are trademarks of Posit™.

Jupyter®, JupyterLab®, and the Jupyter® logos are trademarks or registered trademarks of NumFOCUS.

All third-party trademarks (including logos and icons) referenced remain the property of their respective owners. No affiliation or endorsement is implied.