scancode.io
scancode.io copied to clipboard
Error in running docker image on windows 10.
ERROR 1 (Solved):
While running docker-compose up on windows
I'm getting the error:
/usr/bin/env: ‘python\r’: No such file or directory
nginx_1 | nginx: [emerg] host not found in upstream "web:8000" in /etc/nginx/conf.d/default.conf:2
scancodeio_nginx_1 exited with code 1
worker_1 | wait-for-it: timeout occurred after waiting 15 seconds for web:8000
worker_1 | /usr/bin/env: ‘python\r’: No such file or directory
Tried the Solution provided in #412 , but that didn't work.
ERROR 2:
nginx_1 | 2022/09/04 07:08:32 [notice] 1#1: start worker process 33
worker_1 | wait-for-it: timeout occurred after waiting 15 seconds for web:8000
db_1 | 2022-09-04 07:09:26.348 UTC [27] FATAL: the database system is starting up
web_1 | Traceback (most recent call last):
web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 282, in ensure_connection
web_1 | self.connect()
web_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner
web_1 | return func(*args, **kwargs)
web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 263, in connect
web_1 | self.connection = self.get_new_connection(conn_params)
web_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner
web_1 | return func(*args, **kwargs)
web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/postgresql/base.py", line 215, in get_new_connection
web_1 | connection = Database.connect(**conn_params)
web_1 | File "/usr/local/lib/python3.9/site-packages/psycopg2/__init__.py", line 122, in connect
web_1 | conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
web_1 | psycopg2.OperationalError: FATAL: the database system is starting up
web_1 |
web_1 |
web_1 | The above exception was the direct cause of the following exception:
web_1 |
web_1 | Traceback (most recent call last):
web_1 | File "/app/./manage.py", line 4, in <module>
web_1 | command_line()
web_1 | File "/app/scancodeio/__init__.py", line 45, in command_line
web_1 | execute_from_command_line(sys.argv)
web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
web_1 | utility.execute()
web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 440, in execute
web_1 | self.fetch_command(subcommand).run_from_argv(self.argv)
web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 402, in run_from_argv
web_1 | self.execute(*args, **cmd_options)
web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 448, in execute
web_1 | output = self.handle(*args, **options)
web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 96, in wrapped
web_1 | res = handle_func(*args, **kwargs)
web_1 | File "/usr/local/lib/python3.9/site-packages/django/core/management/commands/migrate.py", line 114, in handle
web_1 | executor = MigrationExecutor(connection, self.migration_progress_callback)
web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/migrations/executor.py", line 18, in __init__
web_1 | self.loader = MigrationLoader(self.connection)
web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/migrations/loader.py", line 58, in __init__
web_1 | self.build_graph()
web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/migrations/loader.py", line 235, in build_graph
web_1 | self.applied_migrations = recorder.applied_migrations()
web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/migrations/recorder.py", line 81, in applied_migrations
web_1 | if self.has_table():
web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/migrations/recorder.py", line 57, in has_table
web_1 | with self.connection.cursor() as cursor:
web_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner
web_1 | return func(*args, **kwargs)
web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 323, in cursor
web_1 | return self._cursor()
web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 299, in _cursor
web_1 | self.ensure_connection()
web_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner
web_1 | return func(*args, **kwargs)
web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 282, in ensure_connection
web_1 | self.connect()
web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/utils.py", line 91, in __exit__
web_1 | raise dj_exc_value.with_traceback(traceback) from exc_value
web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 282, in ensure_connection
web_1 | self.connect()
web_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner
web_1 | return func(*args, **kwargs)
web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 263, in connect
web_1 | self.connection = self.get_new_connection(conn_params)
web_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner
web_1 | return func(*args, **kwargs)
web_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/postgresql/base.py", line 215, in get_new_connection
web_1 | connection = Database.connect(**conn_params)
web_1 | File "/usr/local/lib/python3.9/site-packages/psycopg2/__init__.py", line 122, in connect
web_1 | conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
web_1 | django.db.utils.OperationalError: FATAL: the database system is starting up
web_1 |
scancodeio_web_1 exited with code 1
worker_1 | DEBUG:rq.worker:Registering birth of worker 727d365442ee43be8c2e9e48fc5b46db
worker_1 | INFO:rq.worker:Worker rq:worker:727d365442ee43be8c2e9e48fc5b46db: started, version 1.11.0
worker_1 | INFO:rq.worker:Subscribing to channel rq:pubsub:727d365442ee43be8c2e9e48fc5b46db
worker_1 | INFO:rq.worker:*** Listening on default...
worker_1 | DEBUG:rq.worker:Sent heartbeat to prevent worker timeout. Next one should arrive within 480 seconds.
worker_1 | INFO:rq.worker:Cleaning registries for queue: default
worker_1 | INFO Synchronizing QUEUED and RUNNING Runs with their related Jobs...
db_1 | 2022-09-04 07:10:02.985 UTC [28] FATAL: the database system is starting up
worker_1 | ERROR:rq.worker:Worker rq:worker:727d365442ee43be8c2e9e48fc5b46db: found an unhandled exception, quitting...
worker_1 | Traceback (most recent call last):
worker_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 282, in ensure_connection
worker_1 | self.connect()
worker_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner
worker_1 | return func(*args, **kwargs)
worker_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 263, in connect
worker_1 | self.connection = self.get_new_connection(conn_params)
worker_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner
worker_1 | return func(*args, **kwargs)
worker_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/postgresql/base.py", line 215, in get_new_connection
worker_1 | connection = Database.connect(**conn_params)
worker_1 | File "/usr/local/lib/python3.9/site-packages/psycopg2/__init__.py", line 122, in connect
worker_1 | conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
worker_1 | psycopg2.OperationalError: FATAL: the database system is starting up
worker_1 |
worker_1 |
worker_1 | The above exception was the direct cause of the following exception:
worker_1 |
worker_1 | Traceback (most recent call last):
worker_1 | File "/usr/local/lib/python3.9/site-packages/rq/worker.py", line 591, in work
worker_1 | self.run_maintenance_tasks()
worker_1 | File "/app/scancodeio/worker.py", line 57, in run_maintenance_tasks
worker_1 | scanpipe_app.sync_runs_and_jobs()
worker_1 | File "/app/scanpipe/apps.py", line 211, in sync_runs_and_jobs
worker_1 | if queued_or_running:
worker_1 | File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 408, in __bool__
worker_1 | self._fetch_all()
worker_1 | File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 1866, in _fetch_all
worker_1 | self._result_cache = list(self._iterable_class(self))
worker_1 | File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 87, in __iter__
worker_1 | results = compiler.execute_sql(
worker_1 | File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1393, in execute_sql
worker_1 | cursor = self.connection.cursor()
worker_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner
worker_1 | return func(*args, **kwargs)
worker_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 323, in cursor
worker_1 | return self._cursor()
worker_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 299, in _cursor
worker_1 | self.ensure_connection()
worker_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner
worker_1 | return func(*args, **kwargs)
worker_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 282, in ensure_connection
worker_1 | self.connect()
worker_1 | File "/usr/local/lib/python3.9/site-packages/django/db/utils.py", line 91, in __exit__
worker_1 | raise dj_exc_value.with_traceback(traceback) from exc_value
worker_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 282, in ensure_connection
worker_1 | self.connect()
worker_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner
worker_1 | return func(*args, **kwargs)
worker_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 263, in connect
worker_1 | self.connection = self.get_new_connection(conn_params)
worker_1 | File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner
worker_1 | return func(*args, **kwargs)
worker_1 | File "/usr/local/lib/python3.9/site-packages/django/db/backends/postgresql/base.py", line 215, in get_new_connection
worker_1 | connection = Database.connect(**conn_params)
worker_1 | File "/usr/local/lib/python3.9/site-packages/psycopg2/__init__.py", line 122, in connect
worker_1 | conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
worker_1 | django.db.utils.OperationalError: FATAL: the database system is starting up
worker_1 |
worker_1 | DEBUG:rq.worker:Registering death
worker_1 | INFO:rq.worker:Unsubscribing from channel rq:pubsub:727d365442ee43be8c2e9e48fc5b46db
scancodeio_worker_1 exited with code 0
ERROR 1 has been resolved, but i have no idea how to resolve Error 2.
@35C4n0r "ERROR 1 has been resolved"
How did you solve it? I'd like to include the fix in the code.
For ERROR 2, it seems like an issue with the Database service.
Could you try to only start the db
service and check what is failing there.
@tdruez for solving Issue 1 i opened manage.py in an IDE, selected all text and converted Windows(CR LF) to Unix(LF).
The second issue solved on itsel after deleting all the previous file and starting from scratch.
(Can i make a PR for the /usr/bin/env: ‘python\r’: No such file or directory
Issue 1 here?)
@35C4n0r yes please, a PR with the fixed files would be awesome, thanks!
@tdruez, I think the files are all correct, the fault lies with Git's autocrlf = true
(i don't think this is the default setting and i might have changed it in my case). While cloning the repository with Git it automatically converts all Unix(LF) to Windows(CR LF).
Using the command git config --global core.autocrlf false
and the clonig the repo again fixes this problem.
Do we need to make any changes?
If there's nothing we can do for the file in the repo, we should at least add a note in the documentation to have a reference on how to solve this for Windows users. Someone will likely run into this problem again. Thanks for your input @35C4n0r 👍
@tdruez can I make a PR to add this note in the documentation.
@tdruez, I think the files are all correct, the fault lies with Git's
autocrlf = true
(i don't think this is the default setting and i might have changed it in my case). While cloning the repository with Git it automatically converts all Unix(LF) to Windows(CR LF). Using the commandgit config --global core.autocrlf false
and the clonig the repo again fixes this problem.
It appears to be the default for https://gitforwindows.org/ installations. At least, I cannot remember changing that any time manually. I just installed git and went ahead. Glad I found this issue here right away 🙂
Some helpful Info to understand what is going on:
- https://git-scm.com/docs/gitattributes#_end_of_line_conversion
- https://stackoverflow.com/a/20653073
It quite seems like the current version is stored in CRLF format in git. That might be the cause of the problem.
I also fixed it by opening the file in the editor, changing all Line endings to LF and thereafter, it works like a charm.
A warning about the crlf issue was added in the documentation https://github.com/nexB/scancode.io/commit/37d325a03c02dc5ae9205d4b16eaf729253523ee#diff-d9b149498982c0663c3b7170398773361ed5678f1a627e9c2fd8d2c955c563dbR38-R41