Greetings, i started setting up base.py(settings.py) however when importing these lines
import dj_database_url
from decouple import Csv, config
from unipath import Path
I tried to install via the IDE(PYCharm), as recommended by the debugger itself, but I get errors.
Collecting decouple
Using cached decouple-0.0.7.tar.gz (3.3 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_internal\cli\base_command.py", line 180, in exc_logging_wrapper
status = run_func(*args)
^^^^^^^^^^^^^^^
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_internal\cli\req_command.py", line 245, in wrapper
return func(self, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_internal\commands\install.py", line 377, in run
requirement_set = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 95, in resolve
result = self._result = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 546, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 397, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 173, in _add_to_criteria
if not criterion.candidates:
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_vendor\resolvelib\structs.py", line 156, in __bool__
return bool(self._sequence)
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 155, in __bool__
return any(self)
^^^^^^^^^
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 143, in <genexpr>
return (c for c in iterator if id(c) not in self._incompatible_ids)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 47, in _iter_built
candidate = func()
^^^^^^
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 182, in _make_candidate_from_link
base: Optional[BaseCandidate] = self._make_base_candidate_from_link(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 228, in _make_base_candidate_from_link
self._link_candidate_cache[link] = LinkCandidate(
^^^^^^^^^^^^^^
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 293, in __init__
super().__init__(
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 156, in __init__
self.dist = self._prepare()
^^^^^^^^^^^^^^^
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 225, in _prepare
dist = self._prepare_distribution()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 304, in _prepare_distribution
return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_internal\operations\prepare.py", line 525, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_internal\operations\prepare.py", line 640, in _prepare_linked_requirement
dist = _get_prepared_distribution(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_internal\operations\prepare.py", line 71, in _get_prepared_distribution
abstract_dist.prepare_distribution_metadata(
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_internal\distributions\sdist.py", line 54, in prepare_distribution_metadata
self._install_build_reqs(finder)
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_internal\distributions\sdist.py", line 124, in _install_build_reqs
build_reqs = self._get_build_requires_wheel()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_internal\distributions\sdist.py", line 101, in _get_build_requires_wheel
return backend.get_requires_for_build_wheel()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_internal\utils\misc.py", line 751, in get_requires_for_build_wheel
return super().get_requires_for_build_wheel(config_settings=cs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_vendor\pyproject_hooks\_impl.py", line 166, in get_requires_for_build_wheel
return self._call_hook('get_requires_for_build_wheel', {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_vendor\pyproject_hooks\_impl.py", line 321, in _call_hook
raise BackendUnavailable(data.get('traceback', ''))
pip._vendor.pyproject_hooks._impl.BackendUnavailable: Traceback (most recent call last):
File "C:\Users\OtterAndFinek\.virtualenvs\TattooFoundlerProject-1CIClaAs\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 77, in _build_backend
obj = import_module(mod_path)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\OtterAndFinek\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
File "<frozen importlib._bootstrap>", line 1304, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
File "<frozen importlib._bootstrap>", line 1318, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'setuptools'
[notice] A new release of pip is available: 23.3.2 -> 24.0
[notice] To update, run: python.exe -m pip install --upgrade pip
After several attempts, I decided to try to do the same in PowerShell as an admin. Everything was installed there, but in the IDE itself, even after a restart, this problem remains.
This is what is shown in the powershell console.
PS C:\Windows\system32> cd E:\TattooFoundlerProject\TattooFoundler PS E:\TattooFoundlerProject\TattooFoundler> pip install decouple Requirement already satisfied: decouple in c:\users\otterandfinek\appdata\local\packages\pythonsoftwarefoundation.python.3.7_qbz5n2kfra8p0\localcache\local-packages\python37\site-packages (0.0.7) PS E:\TattooFoundlerProject\TattooFoundler> pip install unipath Requirement already satisfied: unipath in c:\users\otterandfinek\appdata\local\packages\pythonsoftwarefoundation.python.3.7_qbz5n2kfra8p0\localcache\local-packages\python37\site-packages (1.1) PS E:\TattooFoundlerProject\TattooFoundler> pip install setuptools >> Requirement already satisfied: setuptools in c:\users\otterandfinek\appdata\local\packages\pythonsoftwarefoundation.python.3.7_qbz5n2kfra8p0\localcache\local-packages\python37\site-packages (68.0.0) PS E:\TattooFoundlerProject\TattooFoundler> pip cache purge >> Files removed: 246 PS E:\TattooFoundlerProject\TattooFoundler> pip install decouple Requirement already satisfied: decouple in c:\users\otterandfinek\appdata\local\packages\pythonsoftwarefoundation.python.3.7_qbz5n2kfra8p0\localcache\local-packages\python37\site-packages (0.0.7) PS E:\TattooFoundlerProject\TattooFoundler> pip install https://pypi.org/simple/decouple/0.5.0/decouple-0.5.0-py3-none-any.whl >> Collecting decouple==0.5.0 ERROR: HTTP error 404 while getting https://pypi.org/simple/decouple/0.5.0/decouple-0.5.0-py3-none-any.whl ERROR: Could not install requirement decouple==0.5.0 from https://pypi.org/simple/decouple/0.5.0/decouple-0.5.0-py3-none-any.whl because of HTTP error 404 Client Error: Not Found for url: https://pypi.org/simple/decouple/0.5.0/decouple-0.5.0-py3-none-any.whl for URL https://pypi.org/simple/decouple/0.5.0/decouple-0.5.0-py3-none-any.whl
As you can see, I tried to install them manually, cleared the cache and tried to reinstall, but this did not produce any results, what could be the problem?
I originally got stuck on this because of a runserver bug
this is my settings.py
import dj_database_url
from decouple import Csv, config
from unipath import Path
BASE_DIR = Path(__file__).resolve().parent.parent
# ==============================================================================
# CORE SETTINGS
# ==============================================================================
SECRET_KEY = config("SECRET_KEY", default="django-insecure$TattooFoundler.settings.local")
DEBUG = config("DEBUG", default=True, cast=bool)
ALLOWED_HOSTS = config("ALLOWED_HOSTS", default="127.0.0.1,localhost", cast=Csv())
INSTALLED_APPS = [
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"TattooFoundler.apps.accounts",
"TattooFoundler.apps.core",
]
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
ROOT_URLCONF = "TattooFoundler.urls"
INTERNAL_IPS = ["127.0.0.1"]
WSGI_APPLICATION = "TattooFoundler.wsgi.application"
# ==============================================================================
# MIDDLEWARE SETTINGS
# ==============================================================================
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]
# ==============================================================================
# TEMPLATES SETTINGS
# ==============================================================================
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [BASE_DIR / "templates"],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
],
},
},
]
# ==============================================================================
# DATABASES SETTINGS
# ==============================================================================
DATABASES = {
"default": dj_database_url.config(
default=config("DATABASE_URL", default="postgres://TattooFoundler:TattooFoundler@localhost:5432/TattooFoundler"),
conn_max_age=600,
)
}
# ==============================================================================
# AUTHENTICATION AND AUTHORIZATION SETTINGS
# ==============================================================================
AUTH_PASSWORD_VALIDATORS = [
{
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
},
{
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
},
{
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
},
{
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
},
]
# ==============================================================================
# I18N AND L10N SETTINGS
# ==============================================================================
LANGUAGE_CODE = config("LANGUAGE_CODE", default="en-us")
TIME_ZONE = config("TIME_ZONE", default="UTC")
USE_I18N = True
USE_L10N = True
USE_TZ = True
LOCALE_PATHS = [BASE_DIR / "locale"]
# ==============================================================================
# STATIC FILES SETTINGS
# ==============================================================================
STATIC_URL = "/static/"
STATIC_ROOT = BASE_DIR.parent.parent / "static"
STATICFILES_DIRS = [BASE_DIR / "static"]
STATICFILES_FINDERS = (
"django.contrib.staticfiles.finders.FileSystemFinder",
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
)
# ==============================================================================
# MEDIA FILES SETTINGS
# ==============================================================================
MEDIA_URL = "/media/"
MEDIA_ROOT = BASE_DIR.parent.parent / "media"
# ==============================================================================
# THIRD-PARTY SETTINGS
# ==============================================================================
DEBUG = config('DEBUG', default=True, cast=bool)
EMAIL_HOST = config('EMAIL_HOST', default='localhost')
EMAIL_PORT = config('EMAIL_PORT', default=25, cast=int)
# ==============================================================================
# FIRST-PARTY SETTINGS
# ==============================================================================
TattooFoundler_ENVIRONMENT = config("TattooFoundler_ENVIRONMENT", default="local")
versions, which already means that I have them installed…
Decouple 0.0.7 - installed in the root of the project (although I personally didn’t find anything new there)
Setuptools 68.0.0 - similar.
CSV - I haven’t figured out how to install it at all, but this is not so important, because most likely it can be solved faster.
Config 0.5.1
Python - 3.7.9
Unipath 1.1
pathlib2 (aka path) - 2.3.7.post1.
I updated pip - it didn’t help. 24.0 now.
so this is how looks my requirements settings.txt
dj-database-url==0.5.0
Django==3.2.4
psycopg2-binary==2.9.1
python-decouple==3.4
pytz==2021.1
Config==0.5.1
Python==3.7.9
Unipath==1.1
pathlib2==2.3.7.post1
pip==24.0