microsoft / TextWorld

​TextWorld is a sandbox learning environment for the training and evaluation of reinforcement learning (RL) agents on text-based games.
Other
1.22k stars 189 forks source link

unable to install on MacOS 14.4 #345

Closed lhk closed 6 months ago

lhk commented 7 months ago

I'm using a Macbook Pro with an M2 chip. To install textworld, I've created a new conda environment containing only python 3.12.3 and pip. I've installed the dependencies with brew brew install libffi curl git. Then I've cloned the repo and tried installing with pip:

pip install .
Processing /Users/lklein/Documents/programming/TextWorld
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Collecting numpy>=1.14.5 (from textworld==1.6.2rc1)
  Using cached numpy-1.26.4-cp312-cp312-macosx_11_0_arm64.whl.metadata (61 kB)
Collecting tqdm>=4.17.1 (from textworld==1.6.2rc1)
  Using cached tqdm-4.66.2-py3-none-any.whl.metadata (57 kB)
Collecting cffi>=1.0.0 (from textworld==1.6.2rc1)
  Using cached cffi-1.16.0-cp312-cp312-macosx_11_0_arm64.whl.metadata (1.5 kB)
Collecting networkx>=2 (from textworld==1.6.2rc1)
  Using cached networkx-3.3-py3-none-any.whl.metadata (5.1 kB)
Collecting more-itertools (from textworld==1.6.2rc1)
  Using cached more_itertools-10.2.0-py3-none-any.whl.metadata (34 kB)
Collecting tatsu>=5.8.3 (from textworld==1.6.2rc1)
  Using cached TatSu-5.12.0-py3-none-any.whl.metadata (14 kB)
Collecting hashids>=1.2.0 (from textworld==1.6.2rc1)
  Using cached hashids-1.3.1-py2.py3-none-any.whl.metadata (5.5 kB)
Collecting jericho>=3.0.3 (from textworld==1.6.2rc1)
  Using cached jericho-3.1.2.tar.gz (1.3 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [194 lines of output]
      rm -f src/*.h src/*.a
      rm -f src/libfrotz.so
      rm -f src/curses/defines.h
      rm -f frotz_python_interface/libfrotz.so
      find . -name *.o -exec rm -f {} \;
      find . -name *.O -exec rm -f {} \;
      #gcc -O3 -fPIC -o src/common/buffer.o -c src/common/buffer.c
      #gcc -O3 -fPIC -o src/common/err.o -c src/common/err.c
      #gcc -O3 -fPIC -o src/common/fastmem.o -c src/common/fastmem.c
      #gcc -O3 -fPIC -o src/common/files.o -c src/common/files.c
      gcc -O3 -fPIC -I/opt/local/include -o src/common/buffer.o -c src/common/buffer.c
      gcc -O3 -fPIC -I/opt/local/include -o src/common/err.o -c src/common/err.c
      gcc -O3 -fPIC -I/opt/local/include -o src/common/fastmem.o -c src/common/fastmem.c
      gcc -O3 -fPIC -I/opt/local/include -o src/common/files.o -c src/common/files.c
      #gcc -O3 -fPIC -o src/common/hotkey.o -c src/common/hotkey.c
      #gcc -O3 -fPIC -o src/common/input.o -c src/common/input.c
      gcc -O3 -fPIC -I/opt/local/include -o src/common/input.o -c src/common/input.c
      gcc -O3 -fPIC -I/opt/local/include -o src/common/hotkey.o -c src/common/hotkey.c
      #gcc -O3 -fPIC -o src/common/main.o -c src/common/main.c
      gcc -O3 -fPIC -I/opt/local/include -o src/common/main.o -c src/common/main.c
      #gcc -O3 -fPIC -o src/common/math.o -c src/common/math.c
      gcc -O3 -fPIC -I/opt/local/include -o src/common/math.o -c src/common/math.c
      #gcc -O3 -fPIC -o src/common/object.o -c src/common/object.c
      #gcc -O3 -fPIC -o src/common/process.o -c src/common/process.c
      gcc -O3 -fPIC -I/opt/local/include -o src/common/object.o -c src/common/object.c
      gcc -O3 -fPIC -I/opt/local/include -o src/common/process.o -c src/common/process.c
      #gcc -O3 -fPIC -o src/common/quetzal.o -c src/common/quetzal.c
      gcc -O3 -fPIC -I/opt/local/include -o src/common/quetzal.o -c src/common/quetzal.c
      #gcc -O3 -fPIC -o src/common/squetzal.o -c src/common/squetzal.c
      gcc -O3 -fPIC -I/opt/local/include -o src/common/squetzal.o -c src/common/squetzal.c
      #gcc -O3 -fPIC -o src/common/random.o -c src/common/random.c
      gcc -O3 -fPIC -I/opt/local/include -o src/common/random.o -c src/common/random.c
      #gcc -O3 -fPIC -o src/common/redirect.o -c src/common/redirect.c
      gcc -O3 -fPIC -I/opt/local/include -o src/common/redirect.o -c src/common/redirect.c
      #gcc -O3 -fPIC -o src/common/screen.o -c src/common/screen.c
      #gcc -O3 -fPIC -o src/common/sound.o -c src/common/sound.c
      gcc -O3 -fPIC -I/opt/local/include -o src/common/screen.o -c src/common/screen.c
      gcc -O3 -fPIC -I/opt/local/include -o src/common/sound.o -c src/common/sound.c
      #gcc -O3 -fPIC -o src/common/stream.o -c src/common/stream.c
      #gcc -O3 -fPIC -o src/common/table.o -c src/common/table.c
      gcc -O3 -fPIC -I/opt/local/include -o src/common/stream.o -c src/common/stream.c
      gcc -O3 -fPIC -I/opt/local/include -o src/common/table.o -c src/common/table.c
      src/common/sound.c:191:21: warning: passing arguments to 'os_stop_sample' without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
                  os_stop_sample (number);
                                 ^
      src/common/sound.c:194:28: warning: passing arguments to 'os_finish_with_sample' without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
                  os_finish_with_sample (number);
                                        ^
      2 warnings generated.
      #gcc -O3 -fPIC -o src/common/text.o -c src/common/text.c
      gcc -O3 -fPIC -I/opt/local/include -o src/common/text.o -c src/common/text.c
      #gcc -O3 -fPIC -o src/common/variable.o -c src/common/variable.c
      gcc -O3 -fPIC -I/opt/local/include -o src/common/variable.o -c src/common/variable.c
      gcc -Wall -Wextra -std=gnu99 -fPIC -Werror=implicit-function-declaration -O3 -fPIC -o src/dumb/dumb_init.o -c src/dumb/dumb_init.c
      gcc -Wall -Wextra -std=gnu99 -fPIC -Werror=implicit-function-declaration -O3 -fPIC -o src/dumb/dumb_input.o -c src/dumb/dumb_input.c
      gcc -Wall -Wextra -std=gnu99 -fPIC -Werror=implicit-function-declaration -O3 -fPIC -o src/dumb/dumb_output.o -c src/dumb/dumb_output.c
      gcc -Wall -Wextra -std=gnu99 -fPIC -Werror=implicit-function-declaration -O3 -fPIC -o src/dumb/dumb_pic.o -c src/dumb/dumb_pic.c
      src/dumb/dumb_input.c:152:39: warning: implicit conversion from 'int' to 'char' changes value from 142 to -114 [-Wconstant-conversion]
            case '0': *dest++ = ZC_FKEY_MIN + 9; break;
                              ~ ~~~~~~~~~~~~^~~
      src/dumb/dumb_input.c:207:43: warning: unused parameter 'prompt' [-Wunused-parameter]
      static bool dumb_read_line(char *s, char *prompt, bool show_cursor,
                                                ^
      src/dumb/dumb_output.c:156:36: warning: unused parameter 's' [-Wunused-parameter]
      void dumb_display_user_input(char *s)
                                         ^
      src/dumb/dumb_output.c:223:26: warning: unused parameter 'top' [-Wunused-parameter]
      void os_scroll_area (int top, int left, int bottom, int right, int units)
                               ^
      src/dumb/dumb_output.c:223:35: warning: unused parameter 'left' [-Wunused-parameter]
      void os_scroll_area (int top, int left, int bottom, int right, int units)
                                        ^
      src/dumb/dumb_output.c:223:45: warning: unused parameter 'bottom' [-Wunused-parameter]
      void os_scroll_area (int top, int left, int bottom, int right, int units)
                                                  ^
      src/dumb/dumb_output.c:223:57: warning: unused parameter 'right' [-Wunused-parameter]
      void os_scroll_area (int top, int left, int bottom, int right, int units)
                                                              ^
      src/dumb/dumb_output.c:223:68: warning: unused parameter 'units' [-Wunused-parameter]
      void os_scroll_area (int top, int left, int bottom, int right, int units)
                                                                         ^
      In file included from src/dumb/dumb_output.c:22:
      In file included from src/dumb/dumb_frotz.h:12:
      src/dumb/../common/frotz.h:792:7: warning: a function declaration without a prototype is deprecated in all versions of C and is treated as a zero-parameter prototype in C2x, conflicting with a subsequent definition [-Wdeprecated-non-prototype]
      void    os_finish_with_sample ();
              ^
      src/dumb/dumb_output.c:438:6: note: conflicting prototype is here
      void os_finish_with_sample (int UNUSED (a)) {}
           ^
      In file included from src/dumb/dumb_output.c:22:
      In file included from src/dumb/dumb_frotz.h:12:
      src/dumb/../common/frotz.h:813:7: warning: a function declaration without a prototype is deprecated in all versions of C and is treated as a zero-parameter prototype in C2x, conflicting with a subsequent definition [-Wdeprecated-non-prototype]
      void    os_stop_sample ();
              ^
      src/dumb/dumb_output.c:440:6: note: conflicting prototype is here
      void os_stop_sample (int UNUSED (a)) {}
           ^
      src/dumb/dumb_output.c:136:13: warning: unused function 'dumb_copy_cell' [-Wunused-function]
      static void dumb_copy_cell(int dest_row, int dest_col,
                  ^
      2 warnings generated.
      gcc -Wall -Wextra -std=gnu99 -fPIC -Werror=implicit-function-declaration -O3 -fPIC -o src/dumb/dumb_blorb.o -c src/dumb/dumb_blorb.c
      gcc -Wall -Wextra -std=gnu99 -fPIC -Werror=implicit-function-declaration -O3 -fPIC -o src/blorb/blorblib.o -c src/blorb/blorblib.c
      gcc -Wall -Wextra -std=gnu99 -fPIC -Werror=implicit-function-declaration -O3 -fPIC -o src/ztools/infodump.o -c src/ztools/infodump.c
      gcc -Wall -Wextra -std=gnu99 -fPIC -Werror=implicit-function-declaration -O3 -fPIC -o src/ztools/showhead.o -c src/ztools/showhead.c
      9 warnings generated.
      gcc -Wall -Wextra -std=gnu99 -fPIC -Werror=implicit-function-declaration -O3 -fPIC -o src/ztools/showdict.o -c src/ztools/showdict.c
      In file included from src/ztools/infodump.c:54:
      src/ztools/tx.h:383:8: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
      extern option_inform;
      ~~~~~~ ^
      int
      src/ztools/infodump.c:487:43: error: incompatible pointer to integer conversion passing 'unsigned short *' to parameter of type 'unsigned short'; remove & [-Wint-conversion]
          configure_inform_tables(obj_data_end, &inform_version, &class_numbers_base, &class_numbers_end,
                                                ^~~~~~~~~~~~~~~
      src/ztools/infodump.c:210:35: note: passing argument to parameter here
          (unsigned long, unsigned short, unsigned long, unsigned long, unsigned long,
                                        ^
      src/ztools/infodump.c:487:60: error: incompatible pointer to integer conversion passing 'unsigned long *' to parameter of type 'unsigned long'; remove & [-Wint-conversion]
          configure_inform_tables(obj_data_end, &inform_version, &class_numbers_base, &class_numbers_end,
                                                                 ^~~~~~~~~~~~~~~~~~~
      src/ztools/infodump.c:210:50: note: passing argument to parameter here
          (unsigned long, unsigned short, unsigned long, unsigned long, unsigned long,
                                                       ^
      src/ztools/infodump.c:487:81: error: incompatible pointer to integer conversion passing 'unsigned long *' to parameter of type 'unsigned long'; remove & [-Wint-conversion]
          configure_inform_tables(obj_data_end, &inform_version, &class_numbers_base, &class_numbers_end,
                                                                                      ^~~~~~~~~~~~~~~~~~
      src/ztools/infodump.c:210:65: note: passing argument to parameter here
          (unsigned long, unsigned short, unsigned long, unsigned long, unsigned long,
                                                                      ^
      src/ztools/infodump.c:488:21: error: incompatible pointer to integer conversion passing 'unsigned long *' to parameter of type 'unsigned long'; remove & [-Wint-conversion]
                          &property_names_base, &property_names_end, &attr_names_base, &attr_names_end);
                          ^~~~~~~~~~~~~~~~~~~~
      src/ztools/infodump.c:210:80: note: passing argument to parameter here
          (unsigned long, unsigned short, unsigned long, unsigned long, unsigned long,
                                                                                     ^
      src/ztools/infodump.c:488:43: error: incompatible pointer to integer conversion passing 'unsigned long *' to parameter of type 'unsigned long'; remove & [-Wint-conversion]
                          &property_names_base, &property_names_end, &attr_names_base, &attr_names_end);
                                                ^~~~~~~~~~~~~~~~~~~
      src/ztools/infodump.c:211:19: note: passing argument to parameter here
           unsigned long, unsigned long, unsigned long);
                        ^
      src/ztools/infodump.c:488:64: error: incompatible pointer to integer conversion passing 'unsigned long *' to parameter of type 'unsigned long'; remove & [-Wint-conversion]
                          &property_names_base, &property_names_end, &attr_names_base, &attr_names_end);
                                                                     ^~~~~~~~~~~~~~~~
      src/ztools/infodump.c:211:34: note: passing argument to parameter here
           unsigned long, unsigned long, unsigned long);
                                       ^
      src/ztools/infodump.c:488:82: error: incompatible pointer to integer conversion passing 'unsigned long *' to parameter of type 'unsigned long'; remove & [-Wint-conversion]
                          &property_names_base, &property_names_end, &attr_names_base, &attr_names_end);
                                                                                       ^~~~~~~~~~~~~~~
      src/ztools/infodump.c:211:49: note: passing argument to parameter here
           unsigned long, unsigned long, unsigned long);
                                                      ^
      8 errors generated.
      make: *** [src/ztools/infodump.o] Error 1
      make: *** Waiting for unfinished jobs....
      In file included from src/ztools/showdict.c:7:
      src/ztools/tx.h:383:8: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
      extern option_inform;
      ~~~~~~ ^
      int
      src/ztools/showdict.c:89:46: warning: incompatible pointer types passing 'char (*)[10]' to parameter of type 'char *' [-Wincompatible-pointer-types]
              decode_text_to_buffer(&word_address, &(dict_word->word));
                                                   ^~~~~~~~~~~~~~~~~~
      src/ztools/showdict.c:15:58: note: passing argument to parameter 'buf' here
      int decode_text_to_buffer (unsigned long *address, char *buf);
                                                               ^
      src/ztools/showdict.c:37:58: warning: unused variable 'length' [-Wunused-variable]
          unsigned int separator_count, word_size, word_count, length;
                                                               ^
      src/ztools/showdict.c:72:19: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
          if (dict_size != word_count) {
              ~~~~~~~~~ ^  ~~~~~~~~~~
      In file included from src/ztools/showhead.c:7:
      src/ztools/tx.h:383:8: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
      extern option_inform;
      ~~~~~~ ^
      int
      3 warnings and 1 error generated.
      src/ztools/showhead.c:350:16: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
              for (i = 4; i < sizeof (header.name); i++)
                          ~ ^ ~~~~~~~~~~~~~~~~~~~~
      1 warning and 1 error generated.
      make: *** [src/ztools/showdict.o] Error 1
      make: *** [src/ztools/showhead.o] Error 1
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/jg/ftkq4jys5t543vdmxz41h0k80000gp/T/pip-install-30q83wqm/jericho_8701ff3735f0419093aaa7bd048f1bc7/setup.py", line 27, in <module>
          subprocess.check_call(['make', 'library', '-j', '4'], cwd=FROTZPATH)
        File "/Users/lklein/anaconda3/envs/foatextenv/lib/python3.12/subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['make', 'library', '-j', '4']' returned non-zero exit status 2.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

What do I need to do to fix this error message?

MarcCote commented 7 months ago

Someone suggested a fix for Jericho see https://github.com/microsoft/jericho/pull/69

lhk commented 6 months ago

I've tested the fix for Jericho, it works. And after installing that version, textworld installs as well (the jericho dependency being already fulfilled)

MarcCote commented 6 months ago

This is now fixed in Jericho 3.2.0.