简体   繁体   中英

How to return to previous version of pip install in django

I have recently downloaded a django project from github, and I downloaded all of the pip install requirements using:

pip install -r requirements.txt

However, I realised that I did not set a virtual env for this project, so it seems that the pip installs have affect the entire computer. I am now getting an error like below when I try to runserver my other django projects:

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\threading.py", line 954, in _bootstrap_inner 
    self.run()
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\threading.py", line 892, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\commands\runserver.py", line 120, in inner_run
    self.check_migrations()
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py", line 458, in check_migrations
    executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\migrations\executor.py", line 18, in __init__
    self.loader = MigrationLoader(self.connection)
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\migrations\loader.py", line 49, in __init__
    self.build_graph()
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\migrations\loader.py", line 274, in build_graph
    raise exc
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\migrations\loader.py", line 248, in build_graph
    self.graph.validate_consistency()
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\migrations\graph.py", line 195, in validate_consistency
    [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\migrations\graph.py", line 195, in <listcomp>
    [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\migrations\graph.py", line 58, in raise_error
    raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration leads.0001_initial dependencies reference nonexistent parent node ('auth', '0012_alter_user_first_name_max_length')
Traceback (most recent call last):
  File "C:\Users\jsooh\projects\Sevenenglish\11-3\manage.py", line 22, in <module>
    main()
  File "C:\Users\jsooh\projects\Sevenenglish\11-3\manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py", line 341, in run_from_argv
    connections.close_all()
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\utils.py", line 230, 
in close_all
    connection.close()
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\asyncio.py", line 
26, in inner
    return func(*args, **kwargs)
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\sqlite3\base.py", line 261, in close
    if not self.is_in_memory_db():
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\sqlite3\base.py", line 380, in is_in_memory_db
    return self.creation.is_in_memory_db(self.settings_dict['NAME'])
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\sqlite3\creation.py", line 12, in is_in_memory_db
    return database_name == ':memory:' or 'mode=memory' in database_name
TypeError: argument of type 'WindowsPath' is not iterable
Traceback (most recent call last):
  File "C:\Users\jsooh\projects\Sevenenglish\11-3\manage.py", line 22, in <module>
    main()
  File "C:\Users\jsooh\projects\Sevenenglish\11-3\manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py", line 341, in run_from_argv
    connections.close_all()
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\utils.py", line 230, 
in close_all
    connection.close()
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\asyncio.py", line 
26, in inner
    return func(*args, **kwargs)
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\sqlite3\base.py", line 261, in close
    if not self.is_in_memory_db():
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\sqlite3\base.py", line 380, in is_in_memory_db
    return self.creation.is_in_memory_db(self.settings_dict['NAME'])
  File "C:\Users\jsooh\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\sqlite3\creation.py", line 12, in is_in_memory_db
    return database_name == ':memory:' or 'mode=memory' in database_name
TypeError: argument of type 'WindowsPath' is not iterable

Is this error occurring because I did not set up a virtual env before I pip installed for the git hub project? Is there any way I can reverse my pip installments to the previous version? Thank you.

Probably this would help you: TypeError: argument of type 'WindowsPath' is not iterable - in django python .

If you think it's something with the install, you can always pip uninstall django (if you want, you could use pip uninstall -r requirements.txt to uninstall the entire file), create a virtual environment, activate it, then pip install -r requirements.txt to install again in the environment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM