Install new library
Installing New Libraries in Your Float16 Remote Instance
This tutorial will guide you through adding new libraries to your Float16 remote instance. Since the remote instance starts as an empty container, you need to install libraries before running your code.
Float16 CLI installed and logged in
If not logged in, refer to the Hello World tutorial
This example scenario, we'll use a script 'cat.py' that imports the 'requests' library to fetch data from a cat fact API.
While you can simply use pip install requests
on your local machine, the process is different for the remote instance.
Step 1 : Create requirements.txt
Create a requirements.txt file to specify dependencies.
This command creates both 'float16.conf' and 'requirements.txt' files.
Open 'requirements.txt' and add the following
This specifies the library name and the version you want to install.
Step 2 : Start the Project
Start the container, which automatically installs packages listed in 'requirements.txt'
Step 3 : Update Libraries (if needed)
After starting the project and successfully installing packages, you might find that the installed version doesn't match your local version. This could potentially affect your code. Here's how to update
Check the current version: pip show <PACKAGE> | grep Version
or pip list
To upgrade the version (e.g., from '2.31.0' to '2.32.3'), edit 'requirements.txt'
Update package dependencies
Step 4 : Run Your Script
Execute your script
Example output (The response is randomly generated, so you may see a different cat fact.):
Congratulations! You've become proficient in installing new libraries in your Float16 remote instance.
Explore More
Learn how to use Float16 CLI for various use cases in our tutorials.
Hello World
Launch your first serverless GPU function and kickstart your journey.
List all library
Explore the complete set of libraries available in your container.
Pre-load model
Accelerate model access using remote storage for improved performance.
Copy output from remote
Efficiently transfer computation results from remote to your local storage.
Server mode
Create your own serverless server for scalable cloud-based applications.
Happy coding with Float16 Serverless GPU!
Last updated