0
votes

I am new to Django, I am creating Virtual environment for the new project, I was able to do it for first time, so i have deactivated virtual environment, deleted the whole folder recreate again. Then I am getting errors as mentioned below. How to fix these error?

I have deleted the folder, opened a new command prompt, I have tried to create the virtualenv in another drive(D:) still getting the same errors. I have used the following commands to get it work 'virtualenv .' and 'virtualenv python3 .'

C:\Programming\Django>virtualenv .

  • C:\users\asus\appdata\local\programs\python\python37\lib\distutils__init__.py:14: UserWarning: The virtualenv distutils package at %s appears to be in the same location as the system distutils? warnings.warn("The virtualenv distutils package at %s appears to be in the same location as the system distutils?")
  • Using real prefix 'c:\users\asus\appdata\local\programs\python\python37' New python executable in D:\Programming\Django\Scripts\python.exe Command D:\Programming\Django\Scripts\python.exe -m pip config list had error code 1 Traceback (most recent call last):

  • File "c:\users\asus\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec)

  • File "c:\users\asus\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code exec(code, run_globals)

  • File "C:\Users\ASUS\AppData\Local\Programs\Python\Python37\Scripts\virtualenv.exe__main__.py", line 9, in

  • File "c:\users\asus\appdata\local\programs\python\python37\lib\site-packages\virtualenv.py", line 793, in main symlink=options.symlink,

  • File "c:\users\asus\appdata\local\programs\python\python37\lib\site-packages\virtualenv.py", line 1088, in create_environment install_wheel(to_install, py_executable, search_dirs, download=download)

  • File "c:\users\asus\appdata\local\programs\python\python37\lib\site-packages\virtualenv.py", line 935, in install_wheel _install_wheel_with_search_dir(download, project_names, py_executable, search_dirs)

  • File "c:\users\asus\appdata\local\programs\python\python37\lib\site-packages\virtualenv.py", line 964, in _install_wheel_with_search_dir config = _pip_config(py_executable, python_path)

  • File "c:\users\asus\appdata\local\programs\python\python37\lib\site-packages\virtualenv.py", line 1043, in _pip_config config[key] = ast.literal_eval(value)

  • File "c:\users\asus\appdata\local\programs\python\python37\lib\ast.py", line 46, in literal_eval node_or_string = parse(node_or_string, mode='eval')

  • File "c:\users\asus\appdata\local\programs\python\python37\lib\ast.py", line 35, in parse return compile(source, filename, mode, PyCF_ONLY_AST)

  • File "", line 1 real_distutils.version ^ IndentationError: unexpected indent

1

1 Answers

1
votes

I believe the issue is that your new virtual environment is on D:\ drive, but your general python is on the C:\ drive, and is what you're trying to build from. Although it would be a little odd if this is true (because of how virtual env's are configured), it is possible; it would be like saying start your car without fuel.

The reason I believe this is the problem is because your Traceback error traces back to the C:\ drive, but your virtual environment isn't configured for that, or vice versa. You can see what I mean if we format your logs.

  • D:\Programming\Django\Scripts\python.exe -m pip config list had error code 1 Traceback (most recent call last):
    • File "c:\users\asus\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec)
    • File "c:\users\asus\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code exec(code, run_globals)
    • File "C:\Users\ASUS\AppData\Local\Programs\Python\Python37\Scripts\virtualenv.exe__main__.py", line 9, in File "c:\users\asus\appdata\local\programs\python\python37\lib\site-packages\virtualenv.py", line 793, in main symlink=options.symlink, File "c:\users\asus\appdata\local\programs\python\python37\lib\site-packages\virtualenv.py", line 1088, in create_environment install_wheel(to_install, py_executable, search_dirs, download=download)
    • File "c:\users\asus\appdata\local\programs\python\python37\lib\site-packages\virtualenv.py", line 935, in install_wheel _install_wheel_with_search_dir(download, project_names, py_executable, search_dirs) File "c:\users\asus\appdata\local\programs\python\python37\lib\site-packages\virtualenv.py", line 964, in _install_wheel_with_search_dir config = _pip_config(py_executable, python_path)
    • File "c:\users\asus\appdata\local\programs\python\python37\lib\site-packages\virtualenv.py", line 1043, in _pip_config config[key] = ast.literal_eval(value) File "c:\users\asus\appdata\local\programs\python\python37\lib\ast.py", line 46, in literal_eval node_or_string = parse(node_or_string, mode='eval')
    • File "c:\users\asus\appdata\local\programs\python\python37\lib\ast.py", line 35, in parse return compile(source, filename, mode, PyCF_ONLY_AST) File "", line 1 real_distutils.version ^ IndentationError: unexpected indent

Because you referenced Django, here is their install guide for windows, just in case. https://docs.djangoproject.com/en/2.2/howto/windows/. If you followed the guide exactly, I would confidently say the issue is not with your environment, and something with your pip install of Django. Maybe try uninstall and reinstall?

Hope this helps! Do let us know what you find.