Django VirtualEnv Setup - 'setuptools pip wheel failed with error code -11'

django tutorial
install django
django documentation
django virtualenv mac
check django version
django runserver
install virtualenv
uninstall django

I'm following a setup tutorial for Django where I have to set up a virtual environment in my folder. I didn't have virtualenv, so I did sudo pip install virtualenv and got this message after it was installed:

Chriss-MacBook-Air:trydjango18 cnowak7$ sudo pip install virtualenv
The directory '/Users/cnowak7/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/cnowak7/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting virtualenv
  Downloading virtualenv-13.1.0-py2.py3-none-any.whl (1.7MB)
    100% |████████████████████████████████| 1.7MB 120kB/s 
Installing collected packages: virtualenv
Successfully installed virtualenv-13.1.0

After this, I tried creating a virtual environment like in the tutorial with virtualenv . and got this abnormal output:

Chriss-MacBook-Air:trydjango18 cnowak7$ virtualenv .
Using base prefix '/Users/cnowak7/anaconda'
New python executable in ./bin/python3
Also creating executable in ./bin/python
Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "/Users/cnowak7/anaconda/bin/virtualenv", line 11, in <module>
    sys.exit(main())
  File "/Users/cnowak7/anaconda/lib/python3.4/site-packages/virtualenv.py", line 832, in main
    symlink=options.symlink)
  File "/Users/cnowak7/anaconda/lib/python3.4/site-packages/virtualenv.py", line 1004, in create_environment
    install_wheel(to_install, py_executable, search_dirs)
  File "/Users/cnowak7/anaconda/lib/python3.4/site-packages/virtualenv.py", line 969, in install_wheel
    'PIP_NO_INDEX': '1'
  File "/Users/cnowak7/anaconda/lib/python3.4/site-packages/virtualenv.py", line 910, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /Users/cnowak7/Deskt...django18/bin/python3 -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel failed with error code -11

So I tried to see if this error would affect my progress in the tutorial, so when I ran source bin/activate, I got this error:

Chriss-MacBook-Air:trydjango18 cnowak7$ source bin/activate
-bash: bin/activate: No such file or directory

I tried uninstalling and reinstalling pip and virtualenv, but this problem persists. Is this possibly because I have every in my Anaconda folder directory? Any help or advice would be appreciated. Thanks.

I ended up solving this problem by going to www.brew.sh and running the following command in my Terminal:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

From my understanding, it basically gave me all the packages and libraries that I was missing that Apple didn't originally give me. I hope this helps for anyone else who was experiencing this same problem.

How to install Django using virtualenv – DreamHost Knowledge Base, Overview Using virtualenv to install Django is recommended on DreamHost Command "python setup.py egg_info" failed with error code 1. After creating your virtual environment, don’t forget to specify the Python version you want to use. In this case, the following command helps to create “my project” in the first path with the –p flag to identify the full path to the version of Python 3 installed: [server]$ virtualenv ~/example.com/my_project -p /home/example_username/opt/python-3.6.2/bin/python3 Running virtualenv with interpreter /home/example_username/opt/python-3.6.2/bin/python3 Using base prefix

try this:

sudo easy_install pip

and then:

virtualenv your_virtualenv

How to Create a Virtual Environment for your Django Projects Using , In this tutorial, we will look at how to install Django by creating a virtual environment (also known as virtualenv) and how to set up a new project. Django Virtual Environment Setup The virtual environment is used by Django to execute an application. It is recommended to create and execute a Django application in a separate environment. Python itself provides “virtualenv” tool to create an isolated Python environment.

I had the same problem as @Rafi. Upon examining error messages after executing

virtualenv .

, I got a clue from this error message:

dyld: Library not loaded: @rpath/libpython3.6m.dylib

Did some search and found out it means bad interactions between virtualenv and Anaconda at this link. This simple solution solved my problem:

pip uninstall virtualenv
conda install virtualenv

Setting up a Django development environment, Ubuntu virtual environment setup. After installing Python and pip you can install virtualenvwrapper (which includes virtualenv). The official  Django installation Virtual environment. Before we install Django we will get you to install an extremely useful tool to help keep your Working with virtualenv. The command above will create a directory called myvenv (or whatever name you chose) that Installing Django. Now that you have your

How to install Django | Django documentation, py -m venv project-name. This will create a folder called 'project-name' if it does not already exist and setup the virtual environment. To activate the environment,​  Virtualenv will isolate your Python/Django setup on a per-project basis. This means that any changes you make to one website won't affect any others you're also developing.

How to install Django on Windows | Django documentation, Python; easy_install and pip; Git; MySQL; virtualenv. Django 1.5. Django Install; Project setup; Database settings; South; pip freeze; Set up your Django app  virtualenv is a CLI tool that needs a Python interpreter to run. If you already have a Python 3.5+ interpreter the best is to use pipx to install virtualenv into an isolated environment. This has the added benefit that later you’ll be able to upgrade virtualenv without affecting other parts of the system.

Starting a Django Project – Real Python, Working with Django and Virtualenv is easy when you have pip installed. advise against using easy_install to install virtualenv when using setuptools < 0.9​.7. How to install Django on Windows¶. This document will guide you through installing Python 3.8 and Django on Windows. It also provides instructions for setting up a virtual environment, which makes it easier to work on Python projects.

Comments
  • try this: pip install setuptools --no-use-wheel --upgrade
  • I tried this with no luck. This is the error I get:
  • Chriss-MacBook-Air:~ cnowak7$ pip install setuptools --no-use-wheel --upgrade Traceback (most recent call last): File "/Users/cnowak7/anaconda/bin/pip", line 5, in <module> from pkg_resources import load_entry_point ImportError: No module named 'pkg_resources'
  • If I'm installing pip and virtualenv again should I uninstall them first?
  • @Rafi yes, better ;)
  • I'm getting sudo: apt-get: command not found. I looked it up and people are saying that Mac-OSX doesn't have that command apparently.
  • @Rafi updated the answer. you dont need to uninstall I think. try the updated answer
  • Traceback (most recent call last): File "/Users/cnowak7/anaconda/bin/pip", line 5, in <module> from pkg_resources import load_entry_point ImportError: No module named 'pkg_resources'
  • Welcome to SO! When you post an answer try to describe your answer... in your case, include some links to wherever you find that solution.