[Python] OpenCap data download from Google colab

Discussão em 'Python' iniciado por Stack, Maio 15, 2025.

  1. Stack

    Stack Membro Participativo

    While using google colab to download data stored on the OpenCap website, I kept running into a problem; error message: “module util was not found.” I tried manually installing that module, but it didn’t seem to work. Here is the script I was trying to run:

    !pip install -q condacolab
    import condacolab
    condacolab.install()
    !pip install python-decouple
    !pip install maskpass==0.3.6
    !pip install requests
    !conda install -c opensim-org opensim=4.4.1=py310np121
    from utils import download_session
    import shutil
    from google.colab import files



    sessionList = [' ... ']


    downloadPath = os.path.join(os.getcwd(), 'Data')
    for session_id in sessionList:

    download_session(session_id,sessionBasePath=downloadPath,downloadVideos=True)
    pathData = os.path.join(downloadPath, 'OpenCapData_' + session_id)
    shutil.make_archive(pathData, 'zip', pathData)
    shutil.rmtree(pathData)
    pathZip = pathData + '.zip'
    files.download(pathZip)


    I found a post on this forum suggesting that there was a problem with the versions of python and numpy. It suggested a way to install an older version of numpy by adding these lines of code:

    !pip install numpy==1.23 --force-reinstall
    !conda install -c opensim-org opensim=4.5=py311np123


    This solved the utils problem but a new problem came up, saying numpy was unable to be imported. I tried to revert to an older version of Python (3.10) on Google Colab to see if that would solve the problem but Colab seems to always default automatically to the most current version of Python. Any assistance would be appreciated.

    Continue reading...

Compartilhe esta Página