BlaiMelendezCatalan / BAT

Other
61 stars 7 forks source link

Error on installation #27

Closed jorgrde1 closed 1 year ago

jorgrde1 commented 1 year ago

Hello there! I've tried to install it with the tutorial and i got this error when is initializing django.

Digest: sha256:10c509cd18db5610678eb2274a5505f6731cd139af9440e2fcbdfcd8241b740c Status: Downloaded newer image for bitnami/minideb:jessie ---> 63e9293af4c3 Step 2/15 : RUN install_packages python gcc python-dev libblas-dev liblapack-dev libatlas-base-dev gfortran g++ libpq-dev libffi6 libffi-dev wget ca-certificates ---> Running in 1a6bf27a3cc0 W: Failed to fetch http://security.debian.org/dists/jessie/updates/main/binary-amd64/Packages 404 Not Found [IP: 151.101.2.132 80]

W: Failed to fetch http://deb.debian.org/debian/dists/jessie/main/binary-amd64/Packages 404 Not Found

E: Some index files failed to download. They have been ignored, or old ones used instead. apt failed, retrying W: Failed to fetch http://deb.debian.org/debian/dists/jessie/main/binary-amd64/Packages 404 Not Found

W: Failed to fetch http://security.debian.org/dists/jessie/updates/main/binary-amd64/Packages 404 Not Found [IP: 151.101.2.132 80]

E: Some index files failed to download. They have been ignored, or old ones used instead. apt failed, retrying W: Failed to fetch http://deb.debian.org/debian/dists/jessie/main/binary-amd64/Packages 404 Not Found

W: Failed to fetch http://security.debian.org/dists/jessie/updates/main/binary-amd64/Packages 404 Not Found [IP: 151.101.2.132 80]

E: Some index files failed to download. They have been ignored, or old ones used instead. ERROR: Service 'django' failed to build: The command '/bin/sh -c install_packages python gcc python-dev libblas-dev liblapack-dev libatlas-base-dev gfortran g++ libpq-dev libffi6 libffi-dev wget ca-certificates' returned a non-zero code: 100

It didnt find the next links: http://security.debian.org/dists/jessie/updates/main/binary-amd64/Packages http://deb.debian.org/debian/dists/jessie/main/binary-amd64/Packages

They arent reachable.

Do you know how could i solve this problem?

jorgrde1 commented 1 year ago

Even if there is another option to run the app

jorgrde1 commented 1 year ago

I updated the /requirements/base.txt Django==1.11.29 numpy==1.11.3 scipy==0.18.1 django-environ==0.4.0 django-debug-toolbar==1.5 django-extensions==1.7.4 aiorest-ws djangorestframework>=3.9.1 ipdb==0.10.1 pgcontents==0.5.0 jupyter==1.0.0 intervaltree==2.1.0 tqdm==3.7.1

jorgrde1 commented 1 year ago

Also changed Dockerfile of django image with:

FROM bitnami/minideb:latest

RUN install_packages python gcc python-dev libblas-dev liblapack-dev libatlas-base-dev gfortran g++ libpq-dev libffi-dev wget ca-certificates
#RUN install_packages libffi6 #this packages isnt found but it seems that with the package below it can run either

RUN apt-get update
RUN apt-get install -y build-essential libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev libffi-dev
RUN apt-get update && apt-get install -y curl
RUN apt-get update && apt-get install -y software-properties-common
RUN add-apt-repository ppa:deadsnakes/ppa
#RUN wget https://www.python.org/ftp/python/3.7.12/Python-3.7.12.tgz && \
#    tar -xvf Python-3.7.12.tgz

# Build and install Python 3.7
#WORKDIR /Python-3.7.12
#RUN ./configure --enable-optimizations && \
#    make -j 4 && \
#    make altinstall

RUN curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
RUN python2 get-pip.py

# Clean up
WORKDIR /
RUN apt-get install pip -y
#RUN rm -rf /Python-3.7.12*
#RUN wget https://bootstrap.pypa.io/get-pip.py --secure-protocol=auto
#RUN python3.7 get-pip.py

ENV PYTHONUNBUFFERED 1

# Requirements have to be pulled and installed here, otherwise caching won't work
COPY ./requirements /requirements
RUN apt-get install libc6-dev
#RUN pip2 install -r /requirements/local.txt

COPY ./compose/django/entrypoint.sh /entrypoint.sh
RUN sed -i 's/\r//' /entrypoint.sh
RUN chmod +x /entrypoint.sh

COPY ./compose/django/start-dev.sh /start-dev.sh
RUN sed -i 's/\r//' /start-dev.sh
RUN chmod +x /start-dev.sh

WORKDIR /app

#ENTRYPOINT ["/entrypoint.sh"]
jorgrde1 commented 1 year ago

Added this 2 lines at the end of docker-compose.yml: links:

jorgrde1 commented 1 year ago

Now i got this error when executing start-dev.sh:

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/migrate.py", line 83, in handle
    executor = MigrationExecutor(connection, self.migration_progress_callback)
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 20, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/loader.py", line 52, in __init__
    self.build_graph()
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/loader.py", line 210, in build_graph
    self.applied_migrations = recorder.applied_migrations()
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/recorder.py", line 65, in applied_migrations
    self.ensure_schema()
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/recorder.py", line 52, in ensure_schema
    if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()):
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/base.py", line 254, in cursor
    return self._cursor()
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/base.py", line 229, in _cursor
    self.ensure_connection()
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/base.py", line 213, in ensure_connection
    self.connect()
  File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/base.py", line 213, in ensure_connection
    self.connect()
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/base.py", line 189, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql/base.py", line 176, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/usr/local/lib/python2.7/dist-packages/psycopg2/__init__.py", line 127, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
jorgrde1 commented 1 year ago

After all i got this print when using "docker compose up":

$ docker compose up
[+] Running 2/0
 ✔ Container bat-postgres-1  Created                                                                                                                                                                                                                                         0.0s 
 ✔ Container bat-django-1    Created                                                                                                                                                                                                                                         0.0s 
Attaching to bat-django-1, bat-postgres-1
bat-postgres-1  | 
bat-postgres-1  | PostgreSQL Database directory appears to contain a database; Skipping initialization
bat-postgres-1  | 
bat-postgres-1  | LOG:  database system was shut down at 2023-05-11 08:16:15 UTC
bat-postgres-1  | LOG:  MultiXact member wraparound protections are now enabled
bat-postgres-1  | LOG:  autovacuum launcher started
bat-postgres-1  | LOG:  database system is ready to accept connections
bat-django-1    | Postgres is up - continuing...
bat-django-1    | Operations to perform:
bat-django-1    |   Apply all migrations: admin, annotation_tool, auth, contenttypes, sessions, sites
bat-django-1    | Running migrations:
bat-django-1    |   Applying contenttypes.0001_initial... OK
bat-django-1    |   Applying auth.0001_initial... OK
bat-django-1    |   Applying admin.0001_initial... OK
bat-django-1    |   Applying admin.0002_logentry_remove_auto_add... OK
bat-django-1    |   Applying annotation_tool.0001_initial... OK
bat-django-1    |   Applying contenttypes.0002_remove_content_type_name... OK
bat-django-1    |   Applying auth.0002_alter_permission_name_max_length... OK
bat-django-1    |   Applying auth.0003_alter_user_email_max_length... OK
bat-django-1    |   Applying auth.0004_alter_user_username_opts... OK
bat-django-1    |   Applying auth.0005_alter_user_last_login_null... OK
bat-django-1    |   Applying auth.0006_require_contenttypes_0002... OK
bat-django-1    |   Applying auth.0007_alter_validators_add_error_messages... OK
bat-django-1    |   Applying auth.0008_alter_user_username_max_length... OK
bat-django-1    |   Applying sessions.0001_initial... OK
bat-django-1    |   Applying sites.0001_initial... OK
bat-django-1    |   Applying sites.0002_alter_domain_unique... OK
bat-django-1    |  * Running on http://0.0.0.0:8000/ (Press CTRL+C to quit)
bat-django-1    |  * Restarting with stat
bat-django-1    | Performing system checks...
bat-django-1    | 
bat-django-1    | System check identified no issues (0 silenced).
bat-django-1    | 
bat-django-1    | Django version 1.11.29, using settings 'config.settings.local'
bat-django-1    | Development server is running at http://0.0.0.0:8000/
bat-django-1    | Using the Werkzeug debugger (http://werkzeug.pocoo.org/)
bat-django-1    | Quit the server with CONTROL-C.
bat-django-1    |  * Debugger is active!
bat-django-1    |  * Debugger PIN: 236-520-711
jorgrde1 commented 1 year ago

But i cannot access on 0.0.0.0:8000

jorgrde1 commented 1 year ago

nvm i just need to access the url: http://0.0.0.0:8003/annotation_tool now it works fine