The most common questions asked about ContainDS Desktop concern the installation of extra Python (or R etc) packages, and why an app runs correctly on the local machine but not within a container. Similarly, there can be confusion as to why an app can locate a data file in the workspace when run locally, but not through the container.
Although a package/module may be installed on your local machine, that is irrelevant really because ContainDS is running everything inside a ‘container’. This deliberately isolates the app from anything that might be installed on your local machine, ensuring that you must install any packages into the container instead. That would mean that when you share the container with someone else, the modules will definitely be available – the app won’t be looking for them somewhere on your colleague’s machine. Having the isolated container is exactly how we can be sure that your app will be correctly reproduced when shared.
Some standard scientific Python packages are preinstalled in the ‘scipy’ versions of the images, so it can make sense to use one of those to create your container – e.g. the streamlit-scipy-single image.
To install any extra Python packages in your container, click the CMD button when your container is highlighted in ContainDS Desktop. This will launch a command prompt (or terminal) where you can ‘pip install’ or ‘conda install’ packages. Note that the container is a Linux environment so it is possible that installation commands for packages could be slightly different compared to installing them on Windows or Mac.
If you have problems accessing the container through the CMD button, try changing your default shell (‘Exec command shell’) to bash in Preferences.
Locating Workspace Files
If your app seems unable to locate files that are in your workspace (e.g. code or data files that are sitting in the same folder as your main Streamlit app’s Python file, or your Jupyter notebook), then please understand that the location of your workspace folder within the container is different to the path from your local machine.
Perhaps your Workspace folder is in /Users/dan/streamlit-launchpad. To access data files in your Workspace folder from your Python script, you would probably be best trying read_csv(‘./myfile.csv’) or similar. The full path from within the container will be /app/myfile.csv. From the local machine it will be /Users/dan/streamlit-launchpad/myfile.csv.