Home > Enterprise >  Problem installing nes-py in WSL ubuntu using conda
Problem installing nes-py in WSL ubuntu using conda

Time:01-03

I was trying to install nes-py in WSL using pip install nes-py, but I got the following error (I am pasting the entire terminal message).

Collecting nes-py
  Using cached nes_py-8.1.8.tar.gz (76 kB)
Requirement already satisfied: gym>=0.17.2 in /home/aarav18/anaconda3/lib/python3.9/site-packages (from nes-py) (0.21.0)
Requirement already satisfied: numpy>=1.18.5 in /home/aarav18/anaconda3/lib/python3.9/site-packages (from nes-py) (1.20.3)
Requirement already satisfied: pyglet<=1.5.11,>=1.4.0 in /home/aarav18/anaconda3/lib/python3.9/site-packages (from nes-py) (1.5.11)
Requirement already satisfied: tqdm>=4.48.2 in /home/aarav18/anaconda3/lib/python3.9/site-packages (from nes-py) (4.62.3)
Requirement already satisfied: cloudpickle>=1.2.0 in /home/aarav18/anaconda3/lib/python3.9/site-packages (from gym>=0.17.2->nes-py) (2.0.0)
Building wheels for collected packages: nes-py
  Building wheel for nes-py (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/aarav18/anaconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-qez02o65/nes-py_a58dccafc96a4ee491ab6256d3849570/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qez02o65/nes-py_a58dccafc96a4ee491ab6256d3849570/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-84x8fqpu
       cwd: /tmp/pip-install-qez02o65/nes-py_a58dccafc96a4ee491ab6256d3849570/
  Complete output (27 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.9
  creating build/lib.linux-x86_64-3.9/nes_py
  copying nes_py/nes_env.py -> build/lib.linux-x86_64-3.9/nes_py
  copying nes_py/_image_viewer.py -> build/lib.linux-x86_64-3.9/nes_py
  copying nes_py/__init__.py -> build/lib.linux-x86_64-3.9/nes_py
  copying nes_py/_rom.py -> build/lib.linux-x86_64-3.9/nes_py
  creating build/lib.linux-x86_64-3.9/nes_py/app
  copying nes_py/app/play_random.py -> build/lib.linux-x86_64-3.9/nes_py/app
  copying nes_py/app/cli.py -> build/lib.linux-x86_64-3.9/nes_py/app
  copying nes_py/app/play_human.py -> build/lib.linux-x86_64-3.9/nes_py/app
  copying nes_py/app/__init__.py -> build/lib.linux-x86_64-3.9/nes_py/app
  creating build/lib.linux-x86_64-3.9/nes_py/wrappers
  copying nes_py/wrappers/joypad_space.py -> build/lib.linux-x86_64-3.9/nes_py/wrappers
  copying nes_py/wrappers/__init__.py -> build/lib.linux-x86_64-3.9/nes_py/wrappers
  running build_ext
  building 'nes_py.lib_nes_env' extension
  creating build/temp.linux-x86_64-3.9
  creating build/temp.linux-x86_64-3.9/nes_py
  creating build/temp.linux-x86_64-3.9/nes_py/nes
  creating build/temp.linux-x86_64-3.9/nes_py/nes/src
  creating build/temp.linux-x86_64-3.9/nes_py/nes/src/mappers
  g   -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/aarav18/anaconda3/include -I/home/aarav18/anaconda3/include -fPIC -O2 -isystem /home/aarav18/anaconda3/include -fPIC -Ines_py/nes/include -I/home/aarav18/anaconda3/include/python3.9 -c nes_py/nes/src/cartridge.cpp -o build/temp.linux-x86_64-3.9/nes_py/nes/src/cartridge.o -std=c  1y -march=native -pipe -O3
  error: command 'g  ' failed: No such file or directory
  ----------------------------------------
  ERROR: Failed building wheel for nes-py
  Running setup.py clean for nes-py
Failed to build nes-py
Installing collected packages: nes-py
    Running setup.py install for nes-py ... error
    ERROR: Command errored out with exit status 1:
     command: /home/aarav18/anaconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-qez02o65/nes-py_a58dccafc96a4ee491ab6256d3849570/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qez02o65/nes-py_a58dccafc96a4ee491ab6256d3849570/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-kqt46_5n/install-record.txt --single-version-externally-managed --compile --install-headers /home/aarav18/anaconda3/include/python3.9/nes-py
         cwd: /tmp/pip-install-qez02o65/nes-py_a58dccafc96a4ee491ab6256d3849570/
    Complete output (27 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.9
    creating build/lib.linux-x86_64-3.9/nes_py
    copying nes_py/nes_env.py -> build/lib.linux-x86_64-3.9/nes_py
    copying nes_py/_image_viewer.py -> build/lib.linux-x86_64-3.9/nes_py
    copying nes_py/__init__.py -> build/lib.linux-x86_64-3.9/nes_py
    copying nes_py/_rom.py -> build/lib.linux-x86_64-3.9/nes_py
    creating build/lib.linux-x86_64-3.9/nes_py/app
    copying nes_py/app/play_random.py -> build/lib.linux-x86_64-3.9/nes_py/app
    copying nes_py/app/cli.py -> build/lib.linux-x86_64-3.9/nes_py/app
    copying nes_py/app/play_human.py -> build/lib.linux-x86_64-3.9/nes_py/app
    copying nes_py/app/__init__.py -> build/lib.linux-x86_64-3.9/nes_py/app
    creating build/lib.linux-x86_64-3.9/nes_py/wrappers
    copying nes_py/wrappers/joypad_space.py -> build/lib.linux-x86_64-3.9/nes_py/wrappers
    copying nes_py/wrappers/__init__.py -> build/lib.linux-x86_64-3.9/nes_py/wrappers
    running build_ext
    building 'nes_py.lib_nes_env' extension
    creating build/temp.linux-x86_64-3.9
    creating build/temp.linux-x86_64-3.9/nes_py
    creating build/temp.linux-x86_64-3.9/nes_py/nes
    creating build/temp.linux-x86_64-3.9/nes_py/nes/src
    creating build/temp.linux-x86_64-3.9/nes_py/nes/src/mappers
    g   -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/aarav18/anaconda3/include -I/home/aarav18/anaconda3/include -fPIC -O2 -isystem /home/aarav18/anaconda3/include -fPIC -Ines_py/nes/include -I/home/aarav18/anaconda3/include/python3.9 -c nes_py/nes/src/cartridge.cpp -o build/temp.linux-x86_64-3.9/nes_py/nes/src/cartridge.o -std=c  1y -march=native -pipe -O3
    error: command 'g  ' failed: No such file or directory
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/aarav18/anaconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-qez02o65/nes-py_a58dccafc96a4ee491ab6256d3849570/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qez02o65/nes-py_a58dccafc96a4ee491ab6256d3849570/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-kqt46_5n/install-record.txt --single-version-externally-managed --compile --install-headers /home/aarav18/anaconda3/include/python3.9/nes-py Check the logs for full command output.

I have tried many fixes, such as cloning the nes-py repo and installing it by running python setup.py install in its directory, changing the MANIFEST.in file, and some others, but nothing worked. If somebody can help in any way, that would be amazing!

Thanks in advance!

P.S. I am new to using both Conda and WSL/Ubuntu, so any help in that regard is appreciated as well. I used to just use cmd integrated with VS Code.

CodePudding user response:

Found the solution. Took a while, but it was a simple one. I just had to install g by running sudo apt install g in the terminal. After that, the nes-py installation worked like a charm.

  • Related