Why can't I install python-socketio?

Question: Why can’t I install python-socketio?

Repl link: https://replit.com/@superspacehog/Remote-Server

I got it installed using pip install python-socketio but then when the repl runs poetry add socketio it makes an error.

Error:

--> poetry add socketio
Using version ^0.2.1 for socketio

Updating dependencies
Resolving dependencies...

Package operations: 2 installs, 0 updates, 0 removals

  • Installing netifaces (0.10.6)

  CalledProcessError

  Command '['pip', 'install', '--no-deps', 'https://files.pythonhosted.org/packages/72/01/ba076082628901bca750bf53b322a8ff10c1d757dc29196a8e6082711c9d/netifaces-0.10.6.tar.gz#sha256=0c4da523f36d36f1ef92ee183f2512f3ceb9a9d2a45f7d19cda5a42c6689ebe0']' returned non-zero exit status 1.

  at /nix/store/xf54733x4chbawkh1qvy9i1i4mlscy1c-python3-3.10.11/lib/python3.10/subprocess.py:526 in run
       522│             # We don't call process.wait() as .__exit__ does that for us.
       523│             raise
       524│         retcode = process.poll()
       525│         if check and retcode:
    →  526│             raise CalledProcessError(retcode, process.args,
       527│                                      output=stdout, stderr=stderr)
       528│     return CompletedProcess(process.args, retcode, stdout, stderr)
       529│ 
       530│ 

The following error occurred when trying to handle this error:


  EnvCommandError

  Command ['pip', 'install', '--no-deps', 'https://files.pythonhosted.org/packages/72/01/ba076082628901bca750bf53b322a8ff10c1d757dc29196a8e6082711c9d/netifaces-0.10.6.tar.gz#sha256=0c4da523f36d36f1ef92ee183f2512f3ceb9a9d2a45f7d19cda5a42c6689ebe0'] errored with the following return code 1
  
  Output:
  Looking in indexes: https://package-proxy.replit.com/pypi/simple/
  Collecting https://files.pythonhosted.org/packages/72/01/ba076082628901bca750bf53b322a8ff10c1d757dc29196a8e6082711c9d/netifaces-0.10.6.tar.gz#sha256=0c4da523f36d36f1ef92ee183f2512f3ceb9a9d2a45f7d19cda5a42c6689ebe0
    Using cached netifaces-0.10.6.tar.gz (25 kB)
  Using legacy 'setup.py install' for netifaces, since package 'wheel' is not installed.
  WARNING: pip is using a content-addressable pool to install files from. This experimental feature is enabled through --use-feature=content-addressable-pool and it is not ready for production.
  Installing collected packages: netifaces
      Running setup.py install for netifaces: started
      Running setup.py install for netifaces: finished with status 'error'
      ERROR: Command errored out with exit status 1:
       command: /nix/store/lwzzgbnj41d657lpxczk6l5f7d5zcnj1-python3-3.10.11/bin/python3.10 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-yroysv9m/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-yroysv9m/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-all57b6q/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/runner/Remote-Server/.pythonlibs/include/python3.10/netifaces
           cwd: /tmp/pip-req-build-yroysv9m/
      Complete output (17 lines):
      running install
      /nix/store/icx0zbk2r2qrpnqpd41q4h4xzr856d4f-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_ext
      checking for getifaddrs...not found.
      checking for getnameinfo...not found.
      checking for socket IOCTLs...not found.
      checking for optional header files...none found.
      checking whether struct sockaddr has a length field...no.
      checking which sockaddr_xxx structs are defined...none!
      checking for routing socket support...no.
      checking for sysctl(CTL_NET...) support...no.
      checking for netlink support...no.
      building 'netifaces' extension
      gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/nix/store/6j93cr35jnhf4md1rr9w4b5mhilc9203-libxcrypt-4.4.33/include -fPIC -DNETIFACES_VERSION=0.10.6 -I/nix/store/xf54733x4chbawkh1qvy9i1i4mlscy1c-python3-3.10.11/include/python3.10 -c netifaces.c -o build/temp.linux-x86_64-cpython-310/netifaces.o
      error: command 'gcc' failed: No such file or directory
      ----------------------------------------
  ERROR: Command errored out with exit status 1: /nix/store/lwzzgbnj41d657lpxczk6l5f7d5zcnj1-python3-3.10.11/bin/python3.10 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-yroysv9m/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-yroysv9m/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-all57b6q/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/runner/Remote-Server/.pythonlibs/include/python3.10/netifaces Check the logs for full command output.
  

  at /nix/store/6lfk2kyiijr9854nvfmxc28jz49vacrs-poetry-in-venv/env/lib/python3.10/site-packages/poetry/utils/env.py:1523 in _run
      1519│                 output = ""
      1520│             else:
      1521│                 output = subprocess.check_output(cmd, stderr=stderr, env=env, **kwargs)
      1522│         except CalledProcessError as e:
    → 1523│             raise EnvCommandError(e, input=input_)
      1524│ 
      1525│         return decode(output)
      1526│ 
      1527│     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

The following error occurred when trying to handle this error:


  PoetryException

  Failed to install https://files.pythonhosted.org/packages/72/01/ba076082628901bca750bf53b322a8ff10c1d757dc29196a8e6082711c9d/netifaces-0.10.6.tar.gz#sha256=0c4da523f36d36f1ef92ee183f2512f3ceb9a9d2a45f7d19cda5a42c6689ebe0

  at /nix/store/6lfk2kyiijr9854nvfmxc28jz49vacrs-poetry-in-venv/env/lib/python3.10/site-packages/poetry/utils/pip.py:27 in pip_install_from_url
       23│     
       24│     try:
       25│         return environment.run_pip(*args)
       26│     except EnvCommandError as e:
    →  27│         raise PoetryException(f"Failed to install {url}") from e
       28│ 
       29│ def pip_install(
       30│     path: Path,
       31│     environment: Env,

exit status 1

Code:

import socketio

sio = socketio.Server()


@sio.event
def connect():
  print("Connected!")

Ah gcc. Let me find one of the topics here for it.

1 Like

Can’t find what I was looking for, and running that command in a random Repl of mine succeeded. I’ll try forking your Repl and seeing if I can replicate the issue that way.

Alright, I can reproduce on your Repl, not sure why it didn’t occur on one of mine.

You can fix this issue in one of the following ways:

  1. Change your replit.nix file to:
{ pkgs }: {
  deps = [
    pkgs.libgccjit
  ];
}
  1. Run gcc in Shell, and hit Enter when it asks you to pick a version

Hope this helps!

Should I create a replit.nix file, if so where?

The file already exists, if you can’t see it, you’ll need to reveal hidden files.

Images

Dots
Show hidden files

I think I’m a problem magnet because I did that and it didn’t show a replit.nix file! :laughing:image

Odd. You could either add it with the contents I listed above, or you could follow my second option.

Oh I thought it was 2 steps, not 2 options, I misread lol! It worked, thanks a ton!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.