How to install custom pakages on Google-Colaboratory

I'm trying to install packages on GOOGLE COLAB, but I'm facing Import error, I can't import Sub module of my main module 'gym'.

I done the following things.

First I cloned the git hub repository through git command (! git clone https://github.com/zoraiz-ali/gym.git)

Then I add the directory using sys.path

import sys
sys.path.append('/content/gym')

Code of my setup.py file is given below

from setuptools import setup

setup(
     name=gym_robot,
     version=0.3,
     url=https://github.com/zoraiz-ali/gym.git,
     author=Zoraiz Ali,
     license=MIT,
     packages=[gym_robot, gym_robot.envs, gym_robot.envs.helper, ],
     include_package_data=True,
     install_requires=[gym, numpy, opencv-python, pillow]
)

The package works very well on my computer/s. So I'm not sure why I'm not able to use it on Colaboratory.

Anyone know the solution please check this.

Topic openai-gym reinforcement-learning deep-learning python

Category Data Science


Include a pip install command at the beginning of your notebook. Check one of the notebooks here, for example: https://github.com/arangodb/interactive_tutorials/blob/master/notebooks/Graph_Retail_DA_I.ipynb


I think this issue is caused by the fact that your module has the same name as another package, which is the gym package for reinforcement learning environments. This package is automatically installed in the google colab environment, so when you try to import gym_robot from gym it assumes you want to import it from the existing package instead of your own module. Since the package doesn't have this function/module it will give an import error. Try changing the name of your own module slightly so it doesn't interfere with the existing gym package.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.