Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: AttributeError: 'PosixPath' object has no attribute 'split' / ImportError: attempted relative import beyond top-level package #1391

Closed
gerroon opened this issue Mar 27, 2024 · 7 comments

Comments

@gerroon
Copy link

gerroon commented Mar 27, 2024

Hi

The Docker dev build is throwing an error which prevents it from starting the container. That is why I can't run the archivebox info command.

The version image: archivebox/archivebox runs fine.

aarchivebox_1  |     > /data
archivebox_1  |
archivebox_1  | [X] Could not find profile "Default" in CHROME_USER_DATA_DIR.
archivebox_1  |     /data/personas/Default/chromium
archivebox_1  |     Make sure you set it to a Chrome user data directory containing a Default profile folder.
archivebox_1  |     For more info see:
archivebox_1  |         https://github.com/ArchiveBox/ArchiveBox/wiki/Configuration#CHROME_USER_DATA_DIR
archivebox_1  |
archivebox_1  |     Try removing /Default from the end e.g.:
archivebox_1  | Traceback (most recent call last):
archivebox_1  |   File "/usr/local/bin/archivebox", line 8, in <module>
archivebox_1  |     sys.exit(main())
archivebox_1  |              ^^^^^^
archivebox_1  |   File "/app/archivebox/cli/__init__.py", line 140, in main
archivebox_1  |     run_subcommand(
archivebox_1  |   File "/app/archivebox/cli/__init__.py", line 74, in run_subcommand
archivebox_1  |     setup_django(in_memory_db=subcommand in fake_db, check_db=cmd_requires_db and not init_pending)
archivebox_1  |   File "/app/archivebox/config.py", line 1390, in setup_django
archivebox_1  |     check_system_config()
archivebox_1  |   File "/app/archivebox/config.py", line 1298, in check_system_config
archivebox_1  |     stderr('        CHROME_USER_DATA_DIR="{}"'.format(config['CHROME_USER_DATA_DIR'].split('/Default')[0]))
archivebox_1  |                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
archivebox_1  | AttributeError: 'PosixPath' object has no attribute 'split'
archivebox_docker_archivebox_1 exited with code 1

Then I go ahead and define Chrome user dir however now it throws another type of error.

- CHROME_USER_DATA_DIR=/data/chrome

Attaching to archivebox_docker_archivebox_1, archivebox_docker_sonic_1
archivebox_1  | [i] [2024-03-27 19:01:23] ArchiveBox v0.7.3: archivebox server --quick-init 0.0.0.0:8000
archivebox_1  |     > /data
archivebox_1  |
archivebox_1  | Traceback (most recent call last):
archivebox_1  |   File "/usr/local/bin/archivebox", line 8, in <module>
archivebox_1  |     sys.exit(main())
archivebox_1  |              ^^^^^^
archivebox_1  |   File "/app/archivebox/cli/__init__.py", line 140, in main
archivebox_1  |     run_subcommand(
archivebox_1  |   File "/app/archivebox/cli/__init__.py", line 74, in run_subcommand
archivebox_1  |     setup_django(in_memory_db=subcommand in fake_db, check_db=cmd_requires_db and not init_pending)
archivebox_1  |   File "/app/archivebox/config.py", line 1425, in setup_django
archivebox_1  |     django.setup()
archivebox_1  |   File "/usr/local/lib/python3.11/site-packages/django/__init__.py", line 24, in setup
archivebox_1  |     apps.populate(settings.INSTALLED_APPS)
archivebox_1  |   File "/usr/local/lib/python3.11/site-packages/django/apps/registry.py", line 124, in populate
archivebox_1  |     app_config.ready()
archivebox_1  |   File "/app/archivebox/core/apps.py", line 8, in ready
archivebox_1  |     from .auth import register_signals
archivebox_1  |   File "/app/archivebox/core/auth.py", line 3, in <module>
archivebox_1  |     from ..config import (
archivebox_1  | ImportError: attempted relative import beyond top-level package
archivebox_docker_archivebox_1 exited with code 1
archivebox_1  | [i] [2024-03-27 19:01:23] ArchiveBox v0.7.3: archivebox server --quick-init 0.0.0.0:8000
archivebox_1  |     > /data
archivebox_1  |
archivebox_1  | Traceback (most recent call last):
@Cinj216
Copy link

Cinj216 commented Mar 27, 2024

Same. Watchtower pulled latest last night and suddenly this container keeps dying with that error when it has been running for months with no issues with prior builds. I'm guessing now I'll have to go in and adjust some configuration to accommodate some change that was made for the sake of change. Many such cases!

@pirate
Copy link
Member

pirate commented Mar 28, 2024

I assume ya'll were running on :dev? Beware :dev is unstable, if you need stability @Cinj216 you should use archivebox/archivebox:main or archivebox/archivebox:0.7.2 instead!

We just pushed a big pre-release last night, and not just for the sake of change, it's a big new security update with the latest Django 4.2 version that we've been working towards upgrading to for years. It'll make a lot of longstanding issues go away, and we'll be able to finally use some of the newer Django Admin UI features that people have been requesting for a long time.

This latest :dev push is exceptionally large, and is likely more unstable than any of our previous early alpha releases. I called this out in the pre-release notes as well: https://github.com/ArchiveBox/ArchiveBox/releases/tag/v0.8.0-rc

The fix for this particular issue should be up within the next few hours, but beware there will likely be other issues in this alpha, so switch back to stable unless you're actually intending to use the unstable branch.

@gerroon
Copy link
Author

gerroon commented Mar 28, 2024

@pirate Thanks for the update. I am willingly using the dev build to test it while in use. I take daily backups so that is fine. I was just reporting the issue.

@readtedium
Copy link

readtedium commented Mar 28, 2024

I tried downgrading to stable as suggested and am still running into the issue. (I should note that some self-hosted application repositories are shipping with the dev version, which might be why this is coming up.)

EDIT: I ultimately fixed it by removing the CHROME_USER_DATA_DIR from my Docker-compose file, which forced a rebuild.

@blastrock
Copy link

Hello,

Facing the same issue here, maybe the docker-compose example should be updated to use main insead:

image: archivebox/archivebox:dev

I didn't even know I was using an unstable version (though I should have checked ^^)

@jimwins
Copy link
Contributor

jimwins commented Apr 6, 2024

I mentioned this elsewhere, but it's this commit that needs to be brought into the dev branch to fix the relative import problem.

@pirate
Copy link
Member

pirate commented Apr 10, 2024

Ah whoops that was caused by a bad merge into main by accident. I just fixed the broken Docker tags: :stable, :main, :0.7, and :0.7.2 should now point to the working previous release again. Sorry for breaking those!

I will also have this fix and a fix for the CHROME_USER_DATA_DIR error merged into dev before v0.8.0 is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants