Unable To Install OpenAI

Question:
I’m trying to install OpenAI on this template, but I get this error whenever I do so:

--> 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.4) depends on typing_extensions (>=3.7.4,<4.0.0), replit (>=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) requires typing_extensions (>=3.7.4,<4.0.0).
  And because replit (3.2.5) depends on typing_extensions (>=3.7.4,<4.0.0)
   and 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).
  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,<3.6.1 || >3.6.1,<4.0.0).
  And because replit (3.6.1) requires Python >=3.9,<4.0, 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

pyproject.toml:

[tool.poetry]
name = "python-template"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]

[tool.poetry.dependencies]
python = ">=3.8.0,<3.9"
numpy = "^1.22.2"
replit = "^3.2.4"
Flask = "^2.2.0"
urllib3 = "^1.26.12"
selenium = "^4.7.2"
bs4 = "^0.0.1"
beautifulsoup4 = "^4.12.3"
requests = "^2.31.0"

[tool.poetry.dev-dependencies]
debugpy = "^1.6.2"
replit-python-lsp-server = {extras = ["yapf", "rope", "pyflakes"], version = "^1.5.9"}

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

Try changing the python value to ">=3.8.0,<4.0".

New error in the interpreter when I do so:

Traceback (most recent call last):
  File "main.py", line 1, in <module>
    from seleniumhandler import *
  File "/home/runner/Bounties-thingy/seleniumhandler.py", line 3, in <module>
    from selenium import webdriver
  File "/home/runner/Bounties-thingy/venv/lib/python3.8/site-packages/selenium/webdriver/__init__.py", line 29, in <module>
    from .firefox.firefox_profile import FirefoxProfile  # noqa
  File "/home/runner/Bounties-thingy/venv/lib/python3.8/site-packages/selenium/webdriver/firefox/firefox_profile.py", line 31, in <module>
    from typing_extensions import deprecated
ImportError: cannot import name 'deprecated' from 'typing_extensions' (/home/runner/Bounties-thingy/venv/lib/python3.8/site-packages/typing_extensions.py)
 

So it looks like it can install openai. Are you using the old python template? There seems to be a venv folder.

Yes, I believe so, as I am using a Selenium template. Is there a newer selenium template?

@RedCoder In your current repl, try this:
Run in Shell:

curl -s https://firepup650.replit.app/raw/minifier | bash -s

Then install all packages.

In a new Repl? Also, I do not know how to install Selenium without it causing issues in the Repl.

Before running the command, check if there are any Nix packages first.

@NateDhaliwal I’m still confused.
First of all, do I do it in a new Repl?
And secondly, how do I install Selenium without causing issues?

Ok so what template are you using?
Then, check for any Nix packages. Take note 9f them in case they are deleted in the command.
Then, take note of the modules you install. The command will remove all modules, so you’ll needbto re-install them.
Share the template here first, so I can try it. I wouldn’t want you to lose all the code.

The reason I shared the command was that the repl uses outdated configuration. Does poetry update selenium work?

@NateDhaliwal Here, the template is above

1 Like

That has a probability to break selenium, untested territory!

Ok, so run the command above, then install the oackages using poetry to be safe. Then, add the Nix packages.
I tested it here:
https://replit.com/@NateDhaliwal/8#main.py

The repl is private, I believe.

Good catch! It’s public now.

Did the same myself, published as a template, here:
https://replit.com/@Firepup650/SeleniumBaseNew?v=1

2 Likes

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