API key error while utilizing yolov5 google colab

I could still execute the same colab notebook yesterday but received API key error now.
The error came from this line:
rf = Roboflow(model_format=“yolov5”, notebook=“roboflow-yolov5”)
Here is the error I received:
RuntimeError Traceback (most recent call last)

in 2 get_ipython().system(‘pip install -q roboflow’) 3 from roboflow import Roboflow ----> 4 rf = Roboflow(model_format=“yolov5”, notebook=“roboflow-yolov5”)

2 frames

/usr/local/lib/python3.9/dist-packages/roboflow/init.py in check_key(api_key, model, notebook, num_retries) 17 def check_key(api_key, model, notebook, num_retries=0): 18 if type(api_key) is not str: —> 19 raise RuntimeError( 20 “API Key is of Incorrect Type \n Expected Type: " 21 + str(type(”"))

RuntimeError: API Key is of Incorrect Type Expected Type: <class ‘str’> Input Type: <class ‘NoneType’>

Hi, @Jack_LI , we released a Python package update yesterday - your notebook may be using an old, cached version.

Update the package with: pip install roboflow>=1.0.1

Dear Mohamed,
Thanks for the reply.
For some weird reason, it returned an error stating that “Could not find a version that satisfies the requirement 1.0.1 (from versions: none)”. However, I checked the version of roboflow and it was 1.0.1
This issue is relatively miner, since I can still upload and unzip my data and execute training.
Do you recommend using the latest google colab notebook for PyTorch yolov5?
Best regards,

I did update the package with the pip command. But its still not working for me.

Can you please change the google collab file directly @Mohamed. @Jack_LI, how were you able to start training? I am still not able to pass the error.

Hi Sarah,
Not sure which Google colab notebook you’re using, so I’ll just give a brief of example.
In the Jupyter notebook, upload your own dataset as a zip file. You can export them from roboflow. Upload them to your drive folder, which should be at the left hand side after you connect to the server. A warning would pop up stating that when disconnecting from server, the file would not be saved. Uploading zipped files to server could take minutes.
In your Jupyter notebook, simply delete all sections related to roboflow (from install, import, to modifying yaml part). Add a new line looking like this:
!unzip mytrainingfile.zip

Finally, you should see folders unzipped. Make sure that you check and revise the data.yaml file in your drive.
Happy training! Let me know if you need more assistance.
Best regards,

1 Like

I completely ignored, this part of the code
“from roboflow import Roboflow
rf = Roboflow(model_format=‘yolov5’, notebook=‘ultralytics’)”

and just went ahead with connecting with the API and it works normally.

That was clever!
Alternatively, I just upload the data to my personal google drive and import them to Colab Notebook. It was far easier and stable compared to uploading the data through zip format.