This article describes how to create an Environment that will rename a requirements.txt which exists in your Workspace which has errors preventing it from starting.
An error in your requirements.txt prevents your Workspace from starting, but you can't edit it because the file does not exist in your Project Files.
It's possible to create an environment which uses a Pre Setup Script to rename the requirements.txt file in the Workspace, allowing the Workspace to start without loading the file.
In this scenario, the requirements.txt file was created in the Workspace but not synced back to the File System. However the requirements.txt has an error, and thus the next time the Workspace is started you receive an error. For example:
In some situations this requirements.txt file may appear back in your Project Files regardless of any explicit syncing actions taken. In that scenario, you can follow our KB on modifying this file here: https://tickets.dominodatalab.com/hc/en-us/articles/10866628706964
If no requirements.txt exists or appears in your Project Files as described in that article, you can create an environment to rename the file in your Workspace.
Creating the Environment
On the Environments page, hit the Create Environment button. You'll only be using this environment once and for a limited purpose, so it does not matter much which base environment you use. For simplicity, you can choose an available Domino Analytics Environment or Domino Standard Environment.
Depending on your Domino version, you'll either need to Build this initial version, or you can hit "Customize before building". In either situation, edit the Environment to add a Pre Setup Script, which can be accessed by expanding the Advanced options. The Pre Setup Script to add is:
mv /mnt/requirements.txt /mnt/requirements-broken.txt.
Start the Workspace Again
Once your new environment builds, modify the Workspace settings to use this environment, and start the Workspace. It will fail again, but the error message observed has changed:
Starting the Workspace Again...Again
Though the last attempt starting the Workspace failed, the Pre Setup Script renamed the requirements.txt file. Once again, change the settings of the Workspace to your preferred environment, and restart the Workspace.
Success! The Workspace opens, and the requirements.txt file has been renamed. Be sure to modify the file so it's valid prior to renaming it back to requirements.txt, and be sure to sync!
If you're facing the issue of an error in your requirements.txt but a file does appear in your Project Files, you may be able to follow the steps here: Cannot open Workspace due to error in requirements.txt, but requirements.txt isn't synced to Project Files