I am using Google Colab to run ViZDoom combined with TensorFlow (specifically, the TF-Agents library). Most of the times when I start the Colab notebook with my code I get the following error:
SystemError: This interpreter version: '3.7.10' doesn't match with version of the interpreter ViZDoom was compiled with: 3.7.11
This happens when I try to import vizdoom, after all the dependencies and other libraries are installed (from vizdoom import *
).
I have managed to make the Colab notebook work by simply running it again from the beginning. Sometimes running it again from the beginning doesn't work, though. It seems to help adding a check for the interpreter version with !python3 --version
before all the installs, but that shouldn't set the python version for the installs.
I have also tried installing ViZDoom in two different ways, both displayed in the complete code below. Neither way of installing it works consistently.
Why is the interpreter version changing? Is there a way to make it stay the same, so I don't have to reinstall everything when it randomly happens not to work?
The code I am running until the problem is (every box is one section of the Colab notebook):
from google.colab import drive
drive.mount('/content/drive')
# To check Python version:
# !python3 --version
%%bash
# Install deps from
# https://github.com/mwydmuch/ViZDoom/blob/master/doc/Building.md#-linux
apt update
apt upgrade
apt install build-essential zlib1g-dev libsdl2-dev libjpeg-dev nasm tar libbz2-dev libgtk2.0-dev \
cmake git libfluidsynth-dev libgme-dev libopenal-dev timidity libwildmidi-dev unzip
# Boost libraries
apt install libboost-all-dev
# Lua binding dependencies
apt install liblua5.1-dev
apt update
apt upgrade
!pip install tf-agents
%%bash
apt update
apt upgrade
# Neither way of installing ViZDoom seem to work consistently. I am installing ViZDoom either way at a time, not both ways at the same time.
!pip install git+https://github.com/mwydmuch/ViZDoom
#!pip install vizdoom
### LINE THAT GOES WRONG ###
from vizdoom import *
### LINE THAT GOES WRONG ###
import numpy as np
import pandas as pd
import seaborn as sbrn
import tensorflow as tf
from tensorflow import keras
from tf_agents.agents.ppo import ppo_agent
from tf_agents.environments import py_environment
from tf_agents.environments import tf_py_environment
from tf_agents.specs import array_spec, BoundedArraySpec, ArraySpec
from tf_agents.networks.actor_distribution_rnn_network import ActorDistributionRnnNetwork
from tf_agents.networks.value_rnn_network import ValueRnnNetwork
from tf_agents.trajectories import time_step
import time
import random
I changed the way I was installing libraries to Google Colab. I have not had further problems with neither TF-Agents nor ViZDoom since.
Instead of multiple cells with different ways of doing each install, I gathered all those cells into a single cell, with a single format to install the libraries:
#%%bash
# Install deps from
# https://github.com/mwydmuch/ViZDoom/blob/master/doc/Building.md#-linux
!sudo apt update
!sudo apt upgrade
!sudo apt install build-essential zlib1g-dev libsdl2-dev libjpeg-dev nasm tar libbz2-dev libgtk2.0-dev \
cmake git libfluidsynth-dev libgme-dev libopenal-dev timidity libwildmidi-dev unzip
# Boost libraries
!sudo apt install libboost-all-dev
# Lua binding dependencies
!sudo apt install liblua5.1-dev
#Install TF-Agents
!pip install tf-agents
#Install ViZDoom
!pip install git+https://github.com/mwydmuch/ViZDoom
!sudo apt update
!sudo apt upgrade
Probably, doing these installs following a single method allowed versions to be compatible across all installations, thus why it worked.