Can't Deploy Replit when Pytorch is installed

Question:
When Pytorch is installed, I have no problem running the Replit, but when I deploy it, it gets stuck when it tries to create a bundle. I’ve even installed the cpu only version of Pytorch. If I omit Pytorch, the Replit deploys with no problem

Steps to reproduce the issue:

  1. Install Pytorch cpu only version from the shell
pip install torch==2.2.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
  1. My pyproject.toml file (Since I installed pytorch within the shell, I commented out the code to install pytorch within the toml file)
[tool.poetry]
name = "lstm-bot"
version = "0.1.0"
description = "A brief description of your project"
authors = [""]

[tool.poetry.dependencies]
python = ">=3.10.11,<3.12"
ta = ">=0.10.2"
scikit-learn = ">=1.2.2"
lumibot = ">=3.1.7"
# torch = {version = "2.2.1", extras = ["cpu"]}

[tool.poetry.dev-dependencies]
pytest = "6.2.4"

[tool.poetry.group.dev.dependencies]
ipykernel = "^6.29.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
  1. Deployment Output
2024-02-25T14:55:20Z info: Deployment: c7ff73bc-5040-40b3-90ad-eb6b3c95d5e1
2024-02-25T14:55:20Z info: Build: 498a26cd-d157-4519-ac36-22319b90a122
2024-02-25T14:55:20Z info: Connecting to builder
2024-02-25T14:55:23Z info: Builder connected
2024-02-25T14:55:24Z info: Installing packages
--> poetry lock --no-update

Updating dependencies

Resolving dependencies...


Writing lock file

--> poetry install

Installing dependencies from lock file


Package operations: 
146 installs, 0 updates, 0 removals


  • Installing h11 (0.14.0)

  • Installing numpy (1.26.4)

  • Installing pycparser (2.21)

  • Installing six (1.16.0)

  • Installing wsproto (1.2.0)

  • Installing blinker (1.7.0)

  • Installing multidict (6.0.5)

  • Installing python-dateutil (2.8.2)

  • Installing simple-websocket (1.0.0)

  • Installing soupsieve (2.5)

  • Installing tzdata (2024.1)

  • Installing urllib3 (1.26.18)

  • Installing webencodings (0.5.1)

  • Installing werkzeug (3.0.1)

  • Installing aiosignal (1.3.1)

  • Installing annotated-types (0.6.0)

  • Installing asttokens (2.4.1)

  • Installing babel (2.14.0)

  • Installing beautifulsoup4 (4.12.3)

  • Installing flask (3.0.2)

  • Installing korean-lunar-calendar (0.3.1)

  • Installing multitasking (0.0.11)

  • Installing lxml (5.1.0)

  • Installing parso (0.8.3)

  • Installing pandas (2.2.1)
  • Installing matplotlib (3.8.3)

  • Installing peewee (3.17.1)

  • Installing platformdirs (4.2.0)

  • Installing ptyprocess (0.7.0)

  • Installing pure-eval (0.2.2)

  • Installing pycares (4.4.0)

  • Installing pydantic-core (2.16.3)

  • Installing pyluach (2.2.0)

  • Installing python-engineio (4.9.0)

  • Installing requests (2.31.0)

  • Installing speaklater (1.3)

  • Installing toolz (0.12.1)

  • Installing traitlets (5.14.1)

  • Installing wcwidth (0.2.13)

  • Installing wtforms (3.1.2)

  • Installing yarl (1.9.4)

  • Installing aiodns (3.1.1)

  • Installing aiohttp (3.9.3)

  • Installing cryptography (42.0.5)

  • Installing decorator (5.1.1)

  • Installing dnspython (2.6.1)

  • Installing exceptiongroup (1.2.0)

  • Installing flask-mail (0.9.1)

  • Installing flask-principal (0.4.0)

  • Installing inflection (0.5.1)

  • Installing iniconfig (2.0.0)

  • Installing jedi (0.19.1)

  • Installing jupyter-core (5.7.1)

  • Installing marshmallow (3.20.2)

  • Installing matplotlib-inline (0.1.6)

  • Installing more-itertools (10.2.0)

  • Installing msgpack (1.0.7)

  • Installing passlib (1.7.4)

  • Installing pexpect (4.9.0)

  • Installing pluggy (0.13.1)

  • Installing prompt-toolkit (3.0.43)

  • Installing py (1.11.0)

  • Installing pydantic (2.6.2)

  • Installing pygments (2.17.2)

  • Installing python-socketio (5.11.1)

  • Installing pyzmq (25.1.2)

  • Installing scipy (1.10.1)

  • Installing seaborn (0.13.2)

  • Installing setuptools (69.1.1)

  • Installing sqlalchemy (2.0.27)

  • Installing sseclient-py (1.8.0)

  • Installing stack-data (0.6.3)

  • Installing tabulate (0.9.0)

  • Installing tenacity (8.2.3)

  • Installing toml (0.10.2)

  • Installing tornado (6.4)

  • Installing tzlocal (5.2)

  • Installing websockets (11.0.3)

  • Installing yfinance (0.2.37)

  • Installing alpaca-py (0.16.0)

  • Installing alpha-vantage (2.3.1)

  • Installing bcrypt (4.1.2)

  • Installing ccxt (4.2.22)

  • Installing comm (0.2.1)

  • Installing debugpy (1.8.1)

  • Installing duckdb (0.10.0)

  • Installing email-validator (2.1.0.post1)

  • Installing flask-marshmallow (1.2.0)

  • Installing flask-security (3.0.0)

  • Installing flask-socketio (5.3.6)

  • Installing flask-sqlalchemy (3.1.1)

  • Installing ibapi (9.81.1.post1)

  • Installing ipython (8.22.1)

  • Installing jsonpickle (3.0.3)

  • Installing jupyter-client (8.6.0)

  • Installing lumiwealth-tradier (0.1.6)

  • Installing marshmallow-sqlalchemy (1.0.0)

  • Installing nest-asyncio (1.6.0)

  • Installing pandas-datareader (0.10.0)

  • Installing pandas-market-calendars (4.4.0)

  • Installing plotly (5.19.0)

  • Installing polygon-api-client (1.13.4)

  • Installing psutil (5.9.8)

  • Installing psycopg2-binary (2.9.9)

  • Installing pyarrow (15.0.0)

  • Installing pytest (6.2.4)

  • Installing python-dotenv (1.0.1)

  • Installing quandl (3.7.0)

  • Installing quantstats-lumi (0.1.6)

  • Installing termcolor (2.4.0)

  • Installing threadpoolctl (3.3.0)

  • Installing tqdm (4.66.2)

  • Installing uuid (1.30)

  • Installing ipykernel (6.29.2)

  • Installing ta (0.11.0)

2024-02-25T14:56:07Z info: Skipping Build as no Build command set
2024-02-25T14:56:07Z info: Pushing pid1 binary layer...
2024-02-25T14:56:09Z info: Created pid1 binary layer
2024-02-25T14:56:09Z info: Skipping Python layer creation
2024-02-25T14:56:09Z info: Pushing Repl layer...
2024-02-25T14:56:09Z info: Retrieved cached nix layer
2024-02-25T14:56:10Z info: Created hosting layer
2024-02-25T15:02:13Z info: Created Repl layer
2024-02-25T15:02:13Z error: could not create bundle

Hello! This may actually be expected behavior, as the project is built from scratch in your deployment, existing CLI-managed deps are not available in the deployment.

If you really can’t convince poetry to install the package you want, you may be able to add your pip command as part of your build command, but that’s not a supported use case.

Finally, you can switch to using pip directly instead of poetry by following the instructions in our recent blog post, if you think requirements.txt would give you the flexibility you need for this package.

Hope this helps!

3 Likes

Thanks, that resolved my issue. I had to import my project from GitHub again and install the CPU version only of torch using pip before executing pip on the requirments.txt

1 Like

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