0

I have been trying to install MEEP on my google colab environment but every solution online does not work for me.

The code I have so far is below:

!wget -c https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
!chmod +x Miniconda3-latest-Linux-x86_64.sh
!bash ./Miniconda3-latest-Linux-x86_64.sh -b -p /usr/local
!conda install -y -c chogan -c conda-forge pymeep

import sys
sys.path.append('/usr/local/lib/python3.6/site-packages/')
import meep as mp

The problem is that this code gives me this error:

ModuleNotFoundError: No module named 'meep'

I was wondering if anyone had the solution to this

Joe B
  • 1

1 Answers1

0

What worked for me was installing python 3.7 version in colab. The code is taken from here.

!wget -c https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
!chmod +x Miniconda3-latest-Linux-x86_64.sh
!bash ./Miniconda3-latest-Linux-x86_64.sh -b -u -p /usr/local 
import os
if os.path.isdir('/content/anaconda'): root_path = '/content/anaconda'
else: root_path = '/usr/local/'
os.environ['PATH'] += f":{root_path}/bin"
!conda create -n mp -c conda-forge pymeep python=3.7 -y
print(">> ", root_path)
import sys
sys.path.append(f'{root_path}envs/mp/lib/python3.7/site-packages/')

At first I tried to use the latest python version in colab, which was 3.10.10. However, it gave me an error saying that one of the packages was missing (glibcxx_3.4.29). So using version 3.7 worked like a charm.

While installing conda don't forget to upgrade to the latest version. For me it was:

!conda install conda=23.5.0 -y
theganske
  • 23
  • 4
  • @FlyingTeller: True. However, due to the fact that you can't use conda environment in colab, that's the only workaround. If you can find another way, I would gladly vote for your answer. – theganske Jun 02 '23 at 11:00