`mdtex2html` cannot be installed on Replit even if it does on my local machine

Bug description:

I am trying to install the mdtex2html library, and while it works seamlessly on my local machine, on Replit I get an error.

--> poetry add 'mdtex2html 1.2.0'

  TypeError

  expected string or bytes-like object

  at venv/lib/python3.10/site-packages/poetry/core/utils/helpers.py:27 in canonicalize_name
       23│ _canonicalize_regex = re.compile(r"[-_]+")
       24│ 
       25│ 
       26│ def canonicalize_name(name):  # type: (str) -> str
    →  27│     return _canonicalize_regex.sub("-", name).lower()
       28│ 
       29│ 
       30│ def module_name(name):  # type: (str) -> str
       31│     return canonicalize_name(name).replace(".", "_").replace("-", "_")
exit status 1

Expected vs Current Behavior:

The package should install instead of giving this error.

Steps to reproduce:

Try to install the mdtex2html using the package manager or even from the console.

Bug appears at this link: https://replit.com/@mrakgr/DLBuggy

We also tried this in a normal Repl and had the same problem.

Screenshot(s)/Screen Recording:

Browser/OS/Device: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 Edg/116.0.1938.81

Replit Profile: https://replit.com/@mrakgr

Try typing poetry add mdtex2html into the shell instead of poetry add 'mdtex2html 1.2.0'.

2 Likes

Tried it just now. I get the same error.

I was able to successfully import the mdtex2html module in my repl.

image

Try to fork your repl and in this repl enter the command poetry add mdtex2html into the shell.

What I’ve done is started a brand new Python repl. I haven’t done anything except run the following. The error I get this time is a bit different. Here is the link: Bare Python - Replit

~/Bare-Python$ poetry add mdtex2html
Using version ^1.2.0 for mdtex2html

Updating dependencies
Resolving dependencies... (0.6s)

Package operations: 3 installs, 0 updates, 0 removals

  • Installing latex2mathml (3.76.0): Installing...
  • Installing markdown (3.4.4): Failed

  CalledProcessError

  Command '['pip', 'install', '--no-deps', 'https://files.pythonhosted.org/packages/1a/b5/228c1cdcfe138f1a8e01ab1b54284c8b83735476cb22b6ba251656ed13ad/Markdown-3.4.4-py3-none-any.whl#sha256=a4c1b65c0957b4bd9e7d86ddc7b3c9868fb9670660f6f99f6d1bca8954d5a941']' 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/1a/b5/228c1cdcfe138f1a8e01ab1b54284c8b83735476cb22b6ba251656ed13ad/Markdown-3.4.4-py3-none-any.whl#sha256=a4c1b65c0957b4bd9e7d86ddc7b3c9868fb9670660f6f99f6d1bca8954d5a941'] errored with the following return code 1
  
  Output:
  Looking in indexes: https://package-proxy.replit.com/pypi/simple/
  Collecting Markdown==3.4.4
    Downloading Markdown-3.4.4-py3-none-any.whl (94 kB)
  • Installing markdown (3.4.4): Failed

  CalledProcessError

  Command '['pip', 'install', '--no-deps', 'https://files.pythonhosted.org/packages/1a/b5/228c1cdcfe138f1a8e01ab1b54284c8b83735476cb22b6ba251656ed13ad/Markdown-3.4.4-py3-none-any.whl#sha256=a4c1b65c0957b4bd9e7d86ddc7b3c9868fb9670660f6f99f6d1bca8954d5a941']' 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/1a/b5/228c1cdcfe138f1a8e01ab1b54284c8b83735476cb22b6ba251656ed13ad/Markdown-3.4.4-py3-none-any.whl#sha256=a4c1b65c0957b4bd9e7d86ddc7b3c9868fb9670660f6f99f6d1bca8954d5a941'] errored with the following return code 1
  
  Output:
  Looking in indexes: https://package-proxy.replit.com/pypi/simple/
  Collecting Markdown==3.4.4
    Downloading Markdown-3.4.4-py3-none-any.whl (94 kB)
  • Installing latex2mathml (3.76.0)
  • Installing markdown (3.4.4): Failed

  CalledProcessError

  Command '['pip', 'install', '--no-deps', 'https://files.pythonhosted.org/packages/1a/b5/228c1cdcfe138f1a8e01ab1b54284c8b83735476cb22b6ba251656ed13ad/Markdown-3.4.4-py3-none-any.whl#sha256=a4c1b65c0957b4bd9e7d86ddc7b3c9868fb9670660f6f99f6d1bca8954d5a941']' 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/1a/b5/228c1cdcfe138f1a8e01ab1b54284c8b83735476cb22b6ba251656ed13ad/Markdown-3.4.4-py3-none-any.whl#sha256=a4c1b65c0957b4bd9e7d86ddc7b3c9868fb9670660f6f99f6d1bca8954d5a941'] errored with the following return code 1
  
  Output:
  Looking in indexes: https://package-proxy.replit.com/pypi/simple/
  Collecting Markdown==3.4.4
    Downloading Markdown-3.4.4-py3-none-any.whl (94 kB)
  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: Markdown
  ERROR: Could not install packages due to an OSError: [Errno 17] File exists: '/home/runner/Bare-Python/.pythonlibs'
  
  

  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/1a/b5/228c1cdcfe138f1a8e01ab1b54284c8b83735476cb22b6ba251656ed13ad/Markdown-3.4.4-py3-none-any.whl#sha256=a4c1b65c0957b4bd9e7d86ddc7b3c9868fb9670660f6f99f6d1bca8954d5a941

  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,

So… Is the package already installed and pip/poetry isn’t aware of it?

I don’t know. Also, we shouldn’t discount the possibility that the two errors I get in a new Python repl and the one in the first post are for different reasons.

I forked your empty Python repl and was able to install the module successfully.

Hmmm, in that case, maybe the installation is failing because I am using the Free tier of Replit. I’ll try upgrading and see how it goes. It might be failing due to the machine running out of memory during the install.

Actually even without upgrading it worked for me just now in both in the Bare Python replit and a fresh one. But in the first one I still get the same error. That is where we actually need this library to install.

I also use the free plan in Replit. See the amount of free memory here: https://replit.com/account#resource-usage

Mhh, maybe just starting a blank Repl and importing the project from Github would work. I mean, would enable us to install the library.

3 Likes

i’m having this same issue. tried forking, uninstalling and reinstalling poetry. nothing seems to work. oddly, my application seems to run fine. when i stop it and run again, i get this TypeError “expected string or bytes-like object” every time.

anyone figure out a solution, other than starting with an entirely new repl and copying the application over?