Python dependency problem on day 95 and 97 (100 days of Python)

When I import openai package and run the project, I’m getting the followup error:

--> poetry add openai
Using version ^1.13.3 for openai

Updating dependencies
Resolving dependencies...

  SolverProblemError

  The current project's Python requirement (>=3.8.0,<3.9) is not compatible with some of the required packages Python requirement:
    - replit requires Python >=3.9,<4.0, so it will not be satisfied for Python >=3.8.0,<3.9
    - replit requires Python >=3.9,<4.0, so it will not be satisfied for Python >=3.8.0,<3.9
    - replit requires Python >=3.9,<4.0, so it will not be satisfied for Python >=3.8.0,<3.9
    - replit requires Python >=3.9,<4.0, so it will not be satisfied for Python >=3.8.0,<3.9
    - replit requires Python >=3.9,<4.0, so it will not be satisfied for Python >=3.8.0,<3.9
  
  Because no versions of replit match >3.2.4,<3.2.5 || >3.2.5,<3.2.6 || >3.2.6,<3.2.7 || >3.2.7,<3.2.8 || >3.2.8,<3.3.0 || >3.3.0,<3.3.1 || >3.3.1,<3.3.2 || >3.3.2,<3.4.0 || >3.4.0,<3.5.0 || >3.5.0,<3.6.0 || >3.6.0,<3.6.1 || >3.6.1,<4.0.0
   and replit (3.2.5) depends on typing_extensions (>=3.7.4,<4.0.0), replit (>3.2.4,<3.2.6 || >3.2.6,<3.2.7 || >3.2.7,<3.2.8 || >3.2.8,<3.3.0 || >3.3.0,<3.3.1 || >3.3.1,<3.3.2 || >3.3.2,<3.4.0 || >3.4.0,<3.5.0 || >3.5.0,<3.6.0 || >3.6.0,<3.6.1 || >3.6.1,<4.0.0) requires typing_extensions (>=3.7.4,<4.0.0).
  And because replit (3.2.6) depends on typing_extensions (>=3.7.4,<4.0.0), replit (>3.2.4,<3.2.7 || >3.2.7,<3.2.8 || >3.2.8,<3.3.0 || >3.3.0,<3.3.1 || >3.3.1,<3.3.2 || >3.3.2,<3.4.0 || >3.4.0,<3.5.0 || >3.5.0,<3.6.0 || >3.6.0,<3.6.1 || >3.6.1,<4.0.0) requires typing_extensions (>=3.7.4,<4.0.0).
  And because replit (3.2.7) depends on typing_extensions (>=3.7.4,<4.0.0)
   and replit (3.2.8) depends on typing_extensions (>=3.7.4,<4.0.0), replit (>3.2.4,<3.3.0 || >3.3.0,<3.3.1 || >3.3.1,<3.3.2 || >3.3.2,<3.4.0 || >3.4.0,<3.5.0 || >3.5.0,<3.6.0 || >3.6.0,<3.6.1 || >3.6.1,<4.0.0) requires typing_extensions (>=3.7.4,<4.0.0).
  And because replit (3.3.0) depends on typing_extensions (>=3.7.4,<4.0.0)
   and replit (3.3.1) depends on typing_extensions (>=3.7.4,<4.0.0), replit (>3.2.4,<3.3.2 || >3.3.2,<3.4.0 || >3.4.0,<3.5.0 || >3.5.0,<3.6.0 || >3.6.0,<3.6.1 || >3.6.1,<4.0.0) requires typing_extensions (>=3.7.4,<4.0.0).
  And because replit (3.3.2) requires Python >=3.9,<4.0
   and replit (3.4.0) requires Python >=3.9,<4.0, replit (>3.2.4,<3.5.0 || >3.5.0,<3.6.0 || >3.6.0,<3.6.1 || >3.6.1,<4.0.0) requires typing_extensions (>=3.7.4,<4.0.0).
  And because replit (3.5.0) requires Python >=3.9,<4.0
   and replit (3.6.0) requires Python >=3.9,<4.0, replit (>3.2.4,<3.6.1 || >3.6.1,<4.0.0) requires typing_extensions (>=3.7.4,<4.0.0).
  And because replit (3.6.1) requires Python >=3.9,<4.0
   and replit (3.2.4) depends on typing_extensions (>=3.7.4,<4.0.0), replit (>=3.2.4,<4.0.0) requires typing_extensions (>=3.7.4,<4.0.0).
  Because no versions of openai match >1.13.3,<2.0.0
   and openai (1.13.3) depends on typing-extensions (>=4.7,<5), openai (>=1.13.3,<2.0.0) requires typing-extensions (>=4.7,<5).
  Thus, openai (>=1.13.3,<2.0.0) is incompatible with replit (>=3.2.4,<4.0.0).
  So, because python-template depends on both replit (^3.2.4) and openai (^1.13.3), version solving failed.

  at venv/lib/python3.8/site-packages/poetry/puzzle/solver.py:241 in _solve
      237│             packages = result.packages
      238│         except OverrideNeeded as e:
      239│             return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
      240│         except SolveFailure as e:
    → 241│             raise SolverProblemError(e)
      242│ 
      243│         results = dict(
      244│             depth_first_search(
      245│                 PackageNode(self._package, packages), aggregate_package_nodes

  • Check your dependencies Python requirement: The Python requirement can be specified via the `python` or `markers` properties
    
    For replit, a possible solution would be to set the `python` property to "<empty>"
    For replit, a possible solution would be to set the `python` property to "<empty>"
    For replit, a possible solution would be to set the `python` property to "<empty>"
    For replit, a possible solution would be to set the `python` property to "<empty>"
    For replit, a possible solution would be to set the `python` property to "<empty>"

    https://python-poetry.org/docs/dependency-specification/#python-restricted-dependencies,
    https://python-poetry.org/docs/dependency-specification/#using-environment-markers
exit status 1

I think the template of the project might be outdated. I tried to change the python version to <=3.9, the dependency problem keeps happening.

Is it just me or anyone else faced this? Can anyone help?

Try poetry update, that might fix it.

1 Like

I tried it, it doesn’t work. I think I need to use Python 3.9 for the project, but venv in the replit is setup to use Python 3.8. How do I update python version?

I’m not familiar with replit.nix files. It is showing:

{ pkgs }: {
  deps = [
    pkgs.python38Full
  ];
  env = {
    PYTHON_LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
      # Needed for pandas / numpy
      pkgs.stdenv.cc.cc.lib
      pkgs.zlib
      # Needed for pygame
      pkgs.glib
      # Needed for matplotlib
      pkgs.xorg.libX11
    ];
    PYTHONBIN = "${pkgs.python38Full}/bin/python3.8";
    LANG = "en_US.UTF-8";
  };
}

Try:

  1. Run my minifier script in Shell, should update to a newer python version:
curl -s https://firepup650.repl.co/raw/minifier|bash -s
  1. Do poetry add openai replit
1 Like

Thank you! It’s working now!!!

1 Like

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