Anaconda error after install on Windows - python-2.7

I want to install Anaconda on my x64 Windows machine, and I downloaded the Python 2.7 version 64-bit installer. The installation process looks good.
Then I installed pip with choco and installed several packages like zbar,
however, when I want to try to launch Anaconda, I entered conda in Powershell, this is what I got:
Traceback (most recent call last):
File "C:\Users\Ruiyang\Anaconda2\Scripts\conda-script.py", line 3, in <module>
import conda.cli
ImportError: No module named conda.cli
Does anyone knows how to fix this?

add anaconda's bin directory to path.
set path=whatever\anaconda\bin;path;

This issue is related to the path variable setting. Quoting from another SO post:
fire up your interpreter and add this line: export PATH=/Users/add
your username here/anaconda/bin:$PATH
Now type python into the interpreter and you will see Anaconda 1.8.0
or whatever version you have. You will have to do this each time you
start a new interpreter.
Also, note that this might occur when the user name in the path on windows contains a space character. Taken from here.

Though #devautor's method doesn't work for me, a comment in his reference shows me the correct answer:
Unset both PYTHONPATH and PYTHONHOME, then my problem is solved.

Related

Spyder won't launch on Windows using 32 bit Anaconda

I am trying to use spyder on windows 10 using python 2.7 32 bit version of anaconda. I am unable to open spyder through the anaconda interface, through a command prompt or through the spyder.exe. I get the following error message in the command prompt:
Traceback (most recent call last):
File "C:\Users\Brendan\Anaconda2\Scripts\spyder-script.py", line 5, in <module>
sys.exit(spyder.app.start.main())
File "C:\Users\Brendan\Anaconda2\lib\site-packages\spyder\app\start.py", line 103, in main
from spyder.app import mainwindow
File "C:\Users\Brendan\Anaconda2\lib\site-packages\spyder\app\mainwindow.py", line 92, in <module>
from qtpy import QtWebEngineWidgets # analysis:ignore
File "C:\Users\Brendan\Anaconda2\lib\site-packages\qtpy\QtWebEngineWidgets.py", line 26, in <module>
from PyQt5.QtWebKitWidgets import QWebPage as QWebEnginePage
ImportError: DLL load failed: The specified procedure could not be found.
Note that I previously had the 64 bit version of anaconda with python 2.7 and spyder worked fine. I have had this problem ever since I uninstalled the 64 bit version and installed the 32 bit version. I also deleted all of the .anaconda, .spyder, etc. folders before reinstalling.
I have also tried most of the suggestions found here: Python Spyder reset here: ImportError: DLL load failed: The specified procedure could not be found. Python and here: Can no Longer open Spyder IDE for Python Programming, including updating all packages
Any insight would be appreciated as I am relatively new to using python and I do not understand the error message being thrown. I am able to locate the QtWebKitWidgets file in the PyQt5 folder.
I know this is old, but I was having the same problem and found the solution! I had an old Anaconda2 64-bit version installed on my computer (Windows 10 x64), but needed to switch to 32-bit Python for a project. I uninstalled the 64-bit version and installed the 32-bit version and couldn't open Anaconda Navigator, Spyder, etc and got a similar error message to above.
The solution can be found here. In short, you need to reinstall a specific PyQt version conda install pyqt=4.10.4. After this, Spyder opened without issue.
I know this is an old thread, but the following worked for me when my spyder IDE wouldn't load.
The problem was that the status of spyder was still running so wouldn't open. To fix this you need to look for a directory called .spyder-py3 in your Users\ directory, then find a file called "spyder.lock". Underneath this file there were a bunch of files called "spyder.lock.a_bunch_of_numbers.newlink". Once I removed all the spyder lock files the Spyder IDE opened.

spyder, numpy, anaconda : cannot import name multiarray

I am on Windows 10, 64bits, use Anaconda 4 and I created an environment with python 2.7 (C:/Anaconda3/envs/python2/python.exe)
In this environment, I successfully installed numpy and when I type "python", enter, "import numpy", enter, it works perfectly in the anaconda prompt window.
In spyder however, when I open a python console and type "import numpy", I get "cannot import name multiarray". I have obviously changed the path of the python interpreter used by spyder to match the python.exe of the environment I created (C:/Anaconda3/envs/python2/python.exe). I also updated the PYTHONSTARTUP to C:/Anaconda3/envs/python2/Lib/site-packages/spyderlib/scientific_startup.py
It's supposed to be the exact same python program running but it's two different behavior. How is it possible and how to fix it ?
PS: I already tried the various solutions to this error like uninstalling numpy and reinstalling it. It shouldn't be a problem with numpy since it works just fine in the python console of the anaconda prompt window.
I solved the problem by executing the spyder version of the python2 environment.
It is located in Anaconda3\envs\python2\Scripts\spyder.exe
I have encountered same issue. I have followed every possible solution, which is stated on stack-overflow. But no luck. The cause of error might be the python console. I have installed a 3.5 Anaconda, and the default console is the python 2.7, which I have installed primarily with pydev. I did this and now it is working absolutely fine. Go to tools>preferences and click on reset to defaults. It might solve the issue. Or another solution is to uninstall the current Anaconda i.e. y.x and installing the correct one according to the default. In my case 2.7 Anaconda instead of 3.5

Spatialite with Python 2 and 3

I am attempting to use spatialite with both Python 2 and 3 on Windows 7.
Rather than try to patch pyspatialite for Python 3, I decided to use the load_extension approach with sqlite3 Python built-in package, similar to how is done here: Sqlite load_extension fail for spatialite in Python and here: Use spatialite extension for SQLite on Windows.
But, on the official (C)Python 2.7 installer, the load_extension was disabled for an issue related to MacOS. This is not with the counterpart for Python 3.4. Furthermore, both installers are built without SQLITE_ENABLE_RTREE=1 (that I'd also like to have).
At first, for Python 2.7, a workaround was to build pysqlite tweaking the setup files to have both R*Tree and extensions. This way does not work for Python 3, since it does not seem to be supported by the current setup.py. From my understand, this is because the package moved to the core Python repository: https://github.com/ghaering/pysqlite/issues/72#issuecomment-94319589
My current solution was to re-build both Python 2.7 and 3.4 with required settings for sqlite3 package. It worked, and I was able to load spatialite as an extension and to create R*Tree.
Does it exist an alternative simpler solution? Did somebody find an alternative solution by working on the setup.py of pyspatialite or pysqlite?
There is an easier solution that I just got working. I'm running Windows 10 with Python 3.5 using the default sqlite3 package, and Spatialite 4.3.
This is how I did it:
Let start with a simple program that loads the spatialite extension (which we haven't installed yet):
import sqlite3
with sqlite3.connect(":memory:") as conn:
conn.enable_load_extension(True)
conn.load_extension("mod_spatialite")
If you run this program you get:
C:\> python test.py
Traceback (most recent call last):
File "test2.py", line 5, in <module>
conn.load_extension("mod_spatialite")
sqlite3.OperationalError: The specified module could not be found.
That means it can't find the mod_spatialite extension. Let's download it from the Spatialite website. At the bottom there's links to "MS Windows binaries". I picked the x86 version, current stable version, and downloaded the file called mod_spatialite-4.3.0a-win-x86.7z. Unzipping that file to the same directory your test.py file is in, and running the program now produces no errors (ie. it works!):
C:\> python test.py
C:\>

Installing anaconda to use with windows

I am lost in the installation process of installing anaconda on windows.
I've installed the windows 32bit package (I'm running windows 7 x64)
I have anaconda in the start menu and I can open the python console and use scipy.stats.t.interval(), the function I am interested in.
However, how do I go about including this in another python program? I think it's something like adding it to the path. For instance, I have the scipy.stats.t.interval() function call in my other python file which I run through cygwin via python myscript.py. However it returns the error:
from scipy.stats import t
ImportError: No module named scipy.stats
I think it might be a change of path / add to path issue, but I'm not sure how to fix it :/. While I try to fix it, I figure I will post for help here.
well you might have two installations of python, one inside the anaconda package, and other which you might have installed earlier. try doing :
which python
from CygWin console.
If it returns:
/usr/bin
then it is definitely a add-to-path problem.
to fix it for CygWin,
you have to add the python installation from anaconda to the path.
try this fromn CygWin:
PATH=path-where-anaconda-is-installed/anaconda/bin:$PATH
and then doing:
which python
should give you:
/path-to-anaconda/anaconda/bin
and then it will work.
Cheers

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.