Build error exit code: 1

Hi,
I am experiencing build error with exit code 1. I also have this in the log:

Collecting click==8.1.3
  Downloading click-8.1.3-py3-none-any.whl (96 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 96.6/96.6 kB 419.4 MB/s eta 0:00:00
Collecting conda==4.3.16
  Downloading conda-4.3.16.tar.gz (299 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 299.3/299.3 kB 473.4 MB/s eta 0:00:00
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      
      WARNING: Your current install method for conda only supports conda
      as a python library.  You are not installing a conda executable command
      or activate/deactivate commands.  If your intention is to install conda
      as a standalone application, currently supported install methods include
      the Anaconda installer and the miniconda installer.  If you'd still like
      for setup.py to create entry points for you, use `utils/setup-testing.py`.
      
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-dqw87lg7/conda_40d56a1b6bbc420da5481ee4bfa06dd2/setup.py", line 35, in <module>
          import conda._vendor.auxlib.packaging  # NOQA
        File "/tmp/pip-install-dqw87lg7/conda_40d56a1b6bbc420da5481ee4bfa06dd2/conda/__init__.py", line 13, in <module>
          from .common.compat import iteritems, text_type
        File "/tmp/pip-install-dqw87lg7/conda_40d56a1b6bbc420da5481ee4bfa06dd2/conda/common/compat.py", line 77, in <module>
          from collections import Iterable
      ImportError: cannot import name 'Iterable' from 'collections' (/usr/local/lib/python3.10/collections/__init__.py)
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

[notice] A new release of pip available: 22.3.1 -> 23.1.2
[notice] To update, run: python -m pip install --upgrade pip

--> ERROR: process "/bin/sh -c pip install --no-cache-dir -r requirements.txt" did not complete successfully: exit code: 1

I am not sure what this means. I have been training models, restarting the Space several times today. Have not seen this issue before. :frowning:
Does anyone know how to fix this?

Hello @ececet,
Can you please share a link to your application and let us see the requirements and so forth?

Hello @merve :slight_smile: I am unfortunately not allowed to share my application because it must remain private. However I can share my requirements.txt and app.py.

absl-py==1.4.0
aiohttp==3.8.4
aiosignal==1.3.1
appnope==0.1.3
asttokens==2.2.1
async-timeout==4.0.2
attrs==22.2.0
backcall==0.2.0
blis==0.7.9
boto3==1.26.91
botocore==1.29.91
brotlipy==0.7.0
cachetools==5.3.0
catalogue==2.0.8
certifi==2021.10.8
click==8.1.3
conda==4.3.16
confection==0.0.4
contourpy==1.0.7
cycler==0.11.0
cymem==2.0.7
datasets==2.10.1
decorator==5.1.1
dill==0.3.6
evaluate==0.4.0
executing==1.2.0
filelock==3.9.1
fonttools==4.39.0
frozenlist==1.3.3
fsspec==2023.3.0
gensim==4.3.1
google-auth==2.16.2
google-auth-oauthlib==0.4.6
greenlet==2.0.2
grpcio==1.51.3
huggingface-hub==0.13.2
importlib-metadata==6.1.0
importlib-resources==5.12.0
ipython==8.11.0
jedi==0.18.2
Jinja2==3.1.2
jmespath==1.0.1
joblib==1.2.0
kiwisolver==1.4.4
langcodes==3.3.0
Markdown==3.4.1
MarkupSafe==2.1.2
matplotlib==3.7.1
matplotlib-inline==0.1.6
multidict==6.0.4
multiprocess==0.70.14
murmurhash==1.0.9
nltk==3.8.1
numpy==1.24.2
oauthlib==3.2.2
packaging==23.0
pandas==1.5.3
parso==0.8.3
pathy==0.10.1
pexpect==4.8.0
pickleshare==0.7.5
Pillow==9.4.0
preshed==3.0.8
prompt-toolkit==3.0.38
protobuf==4.22.1
ptyprocess==0.7.0
pure-eval==0.2.2
pyarrow==11.0.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycosat==0.6.3
pydantic==1.10.6
Pygments==2.14.0
pyparsing==3.0.9
python-dateutil==2.8.2
pytz==2022.7.1
PyYAML==6.0
regex==2022.10.31
requests-oauthlib==1.3.1
responses==0.18.0
rsa==4.9
s3transfer==0.6.0
scikit-learn==1.2.2
scipy==1.10.1
sentence-transformers==2.2.2
sentencepiece==0.1.97
setfit==0.6.0
smart-open==6.3.0
spacy==3.5.1
spacy-legacy==3.0.12
spacy-loggers==1.0.4
SQLAlchemy==2.0.6
srsly==2.4.6
stack-data==0.6.2
tensorboard==2.12.0
tensorboard-data-server==0.7.0
tensorboard-plugin-wit==1.8.1
thinc==8.1.9
threadpoolctl==3.1.0
tokenizers==0.13.2

--extra-index-url https://download.pytorch.org/whl/cu113
torch==1.13.1
torchvision==0.14.1

traitlets==5.9.0
transformers==4.26.1
typer==0.7.0
typing_extensions==4.5.0
wasabi==1.1.1
wcwidth==0.2.6
Werkzeug==2.2.3
xxhash==3.2.0
yarl==1.8.2
zipp==3.15.0

altair<5
catboost

The app looks like this:

import streamlit as st
from huggingface_hub import Repository
import os
from argparse import ArgumentParser

import torch
torch.cuda.empty_cache()
from run_bert import run_bert, get_datasets,  report_gpu

if __name__ == "__main__":
    models_list = ["ltg/norbert2", "ltg/norbert"]

    test_params = [("ltg/norbert2", 128, 256, 0.001), ("ltg/norbert2", 256, 256, 0.001), ("ltg/norbert2", 320, 256, 0.001),
                   ("ltg/norbert2", 512, 256, 0.001), ("ltg/norbert", 320, 256, 0.001),
                   ("ltg/norbert", 512, 256, 0.001), ("NbAiLab/nb-bert-base", 320, 256, 0.001),
                   ("NbAiLab/nb-bert-base", 512, 256, 0.001)]

    st.write("Number of tests: ", len(test_params))

    for model_name, bs, ml, lr in test_params:
        parser = ArgumentParser()
        parser.add_argument("--batch_size", action="store", type=int, default=bs)
        parser.add_argument("--lr", action="store", type=float, default=lr)
        parser.add_argument("--epochs", action="store", type=int, default=20)
        parser.add_argument("--num_threads", action="store", type=int, default=0)
        parser.add_argument("--bert_model_name", default=model_name)
        parser.add_argument("--unit_type", default="all_units")
        parser.add_argument("--freeze", default=True)
        parser.add_argument("--seed_value", default=2023)
        parser.add_argument("--stop_after", default=3)
        parser.add_argument("--max_len", default=ml)
        parser.add_argument("--oversample", default=False)
        args = parser.parse_args()
        st.write(f"{args.bert_model_name} - {args.lr} - {args.batch_size} - {args.max_len} - Oversampled: {args.oversample} - Frozen: {args.freeze}")
        run_bert(args)
        st.write(f"Done with {args.bert_model_name}.")
        report_gpu()

Thank you so much for your interest!

Hello @ececet, regarding the Spaces Streamlit SDK, we don’t use conda. The Python environment is already configured to run Streamlit, given the sdk_version. Could you please try to comment out ‘conda’ from your requirements.txt in the Space branch?

1 Like

Hi @radames, thank you so much! This has solved the problem. I still think it is weird though, because I have been using Huggingface Spaces with streamlit with those configurations for months and it has never been an issue before. Thanks a lot! :slight_smile:

1 Like

I am getting this error while deploying my streamlit app in huggingface. Can anyone help?

hi @Shoaib-33, this is a Python error,
Please try setting Python 3.9 on the yaml README.md on your Space

python_version: 3.9.17


title: My Awesome Space
emoji: :rocket:
colorFrom: “#FF0000
colorTo: “#00FF00
sdk: streamlit
sdk_version: 1.0.0
app_file: app.py
python_version: 3.9.17
pinned: false

is it ok?

Yes, please try it out! thanks

now its showing this error

attrs==22.1.0

beautifulsoup4==4.12.2

altair

numpy==1.21.2

pandas==1.3.3

css==0.1

efficientnet-pytorch==0.7.1

en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.5.0/en_core_web_sm-3.5.0-py3-none-any.whl

GitPython==3.1.31

google==2.0.3

google-auth==2.20.0

google-auth-oauthlib==1.0.0

google-pasta==0.2.0

googletrans==4.0.0rc1

gradio==3.39.0

gradio_client==0.3.0

graphviz==0.20.1

greenlet==2.0.2

grpcio==1.56.0

gTTS==2.3.2

h11==0.9.0

h2==3.2.0

h5py==3.9.0

hpack==3.0.0

hstspreload==2023.1.1

html5lib==1.1

httpcore==0.9.1

httpx==0.13.3

huggingface-hub==0.14.1

humanfriendly==10.0

keras==2.12.0

matplotlib==3.7.1

matplotlib-inline==0.1.6

mdit-py-plugins==0.3.3

newspaper3k==0.2.8

nltk==3.8.1

onnx==1.14.0

this is my requirements.txt file

try pinning altair==4.2.2