No module named pkg_resources

July 2018 Update Most people should now use pip install setuptools (possibly with sudo). Some may need to (re)install the python-setuptools package via their package manager (apt-get install, yum install, etc.). This issue can be highly dependent on your OS and dev environment. See the legacy/other answers below if the above isn’t working for you. Explanation This error message is caused … Read more

Python virtualenv questions

Normally virtualenv creates environments in the current directory. Unless you’re intending to create virtual environments in C:\Windows\system32 for some reason, I would use a different directory for environments. You shouldn’t need to mess with paths: use the activate script (in <env>\Scripts) to ensure that the Python executable and path are environment-specific. Once you’ve done this, the command prompt changes to indicate the … Read more

Updating matplotlib in virtualenv with pip

I am trying to update my matplotlib in virtualenv and now it seems everything crashed 🙁what I did till now is basically, I had previously matplotlib 1.3 now if I activate py virtual environment and check the matplotlib version it shows 2.1 but I cannot import Axes3D from matplotlib. I working on linux platform and using Python 2.7. Further problem, I saw, If I … Read more

No acceptable C compiler found in $PATH when installing python

I’m trying to install a new Python environment on my shared hosting. I follow the steps written in this post: After coming to the ./configure –prefix=/home/<user>/.localpython command, I get the following output: How can this problem be solved? I’ve been trying to find a solution for 3 hours, but I’m still stuck in one place. UPDATE Hostgator does not … Read more

How to activate an Anaconda environment

If this happens you would need to set the PATH for your environment (so that it gets the right Python from the environment and Scripts\ on Windows). Imagine you have created an environment called py33 by using: Here the folders are created by default in Anaconda\envs, so you need to set the PATH as: Now … Read more

Conda version pip install -r requirements.txt –target ./lib

To create an environment named py37 with python 3.7, using the channel conda-forge and a list of packages: Flags explained: -y: Yes, do not ask for confirmation. –force-reinstall: Install the package even if it already exists. -q: Quiet, do not display progress bar. -c: Channels, additional channels to search for packages. These are URLs searched in the … Read more

Where does pip install its packages?

pip when used with virtualenv will generally install packages in the path <virtualenv_name>/lib/<python_ver>/site-packages. For example, I created a test virtualenv named venv_test with Python 2.7, and the django folder is in venv_test/lib/python2.7/site-packages/django.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)