Windows 7 virtualenv envl AssertionError and OSError - python-2.7

AssertionError: C:\Python27\lib\site-packages\virtualenv-1.11-py2.7.egg\EGG-INFO\PKG-INFO is not a subpath of C:\Python27\lib\site-packages\virtualenv-1.11-py2.7.egg\virtualenv_support\setuptools-2.0.2-py2.py3-none-any.whl\
OSError: Command D:\myproject2\envl\Scripts\python.exe -c "import sys, pip; pip...ll\"] + sys.argv[1:])" setuptools pip failed with error code 1
How can I fix the AssertionError and OSError?
I tried "activate", but it doesn't work.
I know activate.bat file didn't exist...
I think it is because of these errors.

I just ran into this today. Although not possibly the best answer, here's what I did:
Completely uninstalled all previous Python versions. (I had 64bit versions of both 2.7 and 3.2 already installed, plus a 32bit version of 2.7)
Removed any remaining files in the python install path(s).
Restarted. (Just in case)
Re-installed python.
Followed the non-chocolatey version of https://zignar.net/2012/06/17/install-python-on-windows/ exactly. (aka I didn't install pip via easy_install, but instead downloaded the get-pip.py file as explained in the guide)
Run which virtualenv to check that virtualenv is installed and being pulled from the correct location. (If not, add the path to you python install to you PATH environment variable, removing any other python paths)
Now when I try virtualenv --no-site-packages <packagename>, it works!

Related

Can't install external packages in Python

My problem is when I'm trying to install an external package via Command Prompt, I'm getting an error. I've just started programming and I don't understand everything yet.
That's an error:
If Python 2 and Python 3 are both installed on the system, they can interfere and cause easy_install to break.
Hence, you will need to specify which version of Python and easy_install you want, like this:
python-2.7 -m easy_install <module>
For any other version of Python, just change the -2.7 to your major.minor version.

pip install for whl files

I am trying to install scipy package for python 2.7 in windows,
The process i followed is as follows:
downloaded a whl file scipy-0.17.1-cp27-cp27m-win32.whl from
http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy
tried to install by
pip install scipy-0.17.1-cp27-cp27m-win32.whl
error : Requirement 'scipy-0.15.1-cp27-none-win32.whl' looks like
a filename but the file does not exist
scipy-0.15.1-cp27-none-win32.whl is not a supported wheelon this platform.
then tried to install by
pip install file_location\scipy-0.17.1-cp27-cp27m-win32.whl.
error displayed :scipy-0.15.1-cp27-none-win32.whl is not a supported wheel on this platform.
Also i have already upgraded my pip command.
Can anyone suggest me out some valid solutions?
I Think the issue in Python interpreter variant 32 or 64.. if your python is 32-bit then use scipy-0.17.1-cp27-cp27m-win32.whl otherwise if your python is 64Bit then try scipy-0.17.1-cp27-cp27m-win_amd64.whl

How to use -pip- to install packages that can work with Anaconda?

I am trying to install some additional packages that do not come with Anaconda. All of these packages can be installed using pip install PackageName. However, when I type this command at the Anaconda Command Prompt, I get the following error:
Fatal error in launcher: Unable to create process using '"C:\Python27\python.exe
" "C:\python27\scripts\pip.exe" install MechanicalSoup'
I also tried to run the command from the python interpreter after import pip but that also did not work (I got a SyntaxError: invalid syntax).
I am a noob and understand that this might be a very basic question so thanks for your help in advance!
PS: I am using Windows 7, 64 bit, conda version: 3.7.1 and python version: 2.7.6.
When installing anaconda, you are asked if you want to include the installed python to your system PATH variable. Make sure you have it in your PATH. If everything is set up correct, you can run pip from your regular command prompt aswell.
Using #heinzchr's and #mmann's suggestions I was able to piece together the problem. I already had a version of Python 2.7 saved at C:\Python27 and I had to remove this from the Path (My Computer's properties> Advanced system settings> System variables> Path). I can now use pip install from the command line.
There is a way around the use of pip
From the anaconda terminal window you can run:
conda install PackageName
Because MechanicalSoup isn't in one of anaconda's package channels you will have to do a bit of editing
See instructions near the bottom on their blog
For those looking for Python packages not added to current channels in anaconda, try https://conda-forge.org/ For example, if you want to install MechanicalSoup you'll find it at https://anaconda.org/conda-forge/mechanicalsoup and use the -c option to tell conda the channel to use:
conda install -c conda-forge mechanicalsoup

How to Install Matplotlib Basemap Module on Windows 7 with WinPython (or any Python stack install)?

I've found that the Basemap (module for matplotlib and Python) binary installer for Windows cannot detect Python on the system when Python is installed as part of a stack install, like Anaconda or WinPython. The installer exits, rather than allow you to point to the directory of installation.
I have to therefore install via source. However, I don't know the method to do this. The Readme.txt and install instructions don't seem to help. They simply instruct to "install geos-3.3.3 first" - well, how exactly? I don't see a setup.py in that directory.
Any help would be great. (Python 2.7, Win 7, 64b)
I use windows. And my installation failed with official guidance, too.
Finally I installed Basemap using the following method. Although I am not sure if it will go right for you, I just offer mine.
First of all, you must have pip in your computer. (It is much easier
to install, compared with Basemap and other things. And it can be
used to install many useful packages.)
Then go this great link: http://www.lfd.uci.edu/~gohlke/pythonlibs/
And download the file named "basemap‑1.1.0‑cp27‑cp27m‑win32.whl".
Move the .whl file to directory "C:\Python27". (Maybe you
installed your python in different disk, then change it
accordingly.)
Open terminal. (Use cmd or Git Bash or something else.)
Use command:
pip install basemap‑1.1.0‑cp27‑cp27m‑win32.whl
The following worked for me using Python 3.10.1.
Setup environment using terminal in Visual Studio Code (https://code.visualstudio.com/docs/python/python-tutorial):
py -3 -m venv .venv
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
.venv\scripts\activate
Install basemap using pip:
pip install matplotlib
pip install basemap-data
pip install basemap-data-hires
pip install basemap
Create file with code from: https://matplotlib.org/basemap/users/examples.html
Remember to select the correct interpreter (In VSCode use Ctrl+Shift+P to select interpreter).
That's it.

Could not find platform independent libraries <prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]

I'm really new to Python and Django.... What I'm trying to do is:
Install Python 2.7 on Mac OS 10.6.8
Install pip Install Django
Install virtualenvwrapper
Create virtual environment
Install Django-Cms
I think, I'll be is ok from Install virtualenvwrapper to the Django-Cms installation because I have already done it, but in the first steps I got some troubles.
I download Python 2.z from python.org the Python 2.7.3 Mac OS X 64-bit/32-bit x86-64/i386 Installer (for Mac OS X 10.6 and later [2]), installed whit the wizard . That create a directory /System/Library/Frameworks/Python.framework/Versions with inside my 2.7 folder.
My directory /System/Library/Python is empty
I'm sure I've Python installed cos:
python --version
Python 2.7.3
but when I try easy_install pip it gave me:
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
'import site' failed; use -v for traceback
Traceback (most recent call last):
File "/usr/bin/easy_install-2.6", line 7, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py", line 16, in <module>
import sys, os, zipimport, time, re, imp, new
ImportError: No module named os**
Now no idea of what does mean ...so if somebody could help out from this and put me on the direction where I can istall my virtualenvwrapper I can take it from there.
I'm Junior a front end developer never touch back end so pls be specific and explain me what I need to do as u speak with a child.
You seem to have things turned around. Virtualenv creates a python environment that encapsulates a python install. So you want to do the following:
Install python
Create a virtualenv using that version of python (eg. virtualenv --python="path to python in 1" virt)
Switch to that virtualenv (workon virt)
Now install Django, etc. inside of the virtualenv virt
Here is the recipe I used to get my environment setup and running.
Are you using homebrew? I've found that's the most reliable way to get stuff on the mac.