microsoft / microsoft/TextWorld

Unable to import textworld in colab

Open
#320 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
1.4k
Forks
207
Avg merge
8d 22h
Merged PRs (30d)
1

Description

Hi, I'm running the notebook 'Building a simple agent' in colab and have encountered the following ImportError when I tried to import textworld.

/usr/local/lib/python3.10/dist-packages/tatsu/grammars.py in
4 import os
5 import functools
----> 6 from collections import defaultdict, Mapping
7 from copy import copy
8 from itertools import takewhile

ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/init.py)

I tried replacing 'from collections import Mapping' with 'from collections.ac import Mapping' and got this error instead:

/usr/local/lib/python3.10/dist-packages/textworld/envs/wrappers/tw_inform7.py in
91
92
---> 93 class TWInform7(textworld.core.Wrapper):
94 """
95 Wrapper to play Inform7 games generated by TextWorld.

AttributeError: partially initialized module 'textworld' has no attribute 'core' (most likely due to a circular import)

The installation of textworld was sucessfull.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the import failure by opening the “Building a simple agent” notebook in Colab. Inspect the failing imports in tatsu/grammars.py and textworld/envs/wrappers/tw_inform7.py, then verify that importing textworld completes without the Python 3.10 errors or circular-import failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
developer-experience, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.