Anaconda Python Modules in Standard Python 3.5 - python

I'm pretty new to programming, and am generally unfamiliar with how stuff like environments and distributions work.
I found myself needing to use a module in the SciPy library for python, and when the standard pip install failed, I got to googling and found that the recommended way to access these modules is to install an entirely new python distribution called Anaconda with it's own more advanced spyder IDE, more included libraries, etc.
I'm not averse to learning the new IDE, but my question is that if I want to continue using the simple and fast IDLE IDE for making scripts that make use of the SciPy modules, is there any way to get my existing Python35 installation recognize the included Anaconda modules? Or do I have to use Anaconda for all of my future programming now?
Note: I was able to get scipy seperately via http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy, but I'm still interested in using the other included anaconda modules.
My apologies if this is an inappropriate question or if it has been answered before, I searched to the best of my abilities but didn't find what I was looking for.

Related

Issue with existing system Python and installing Anaconda for a new Python - new to programming

As someone who is just getting started with programming and installing Python, I am looking for an answer to an installation question that hopefully doesn't involve much coding itself. This is the bottleneck that is keeping me from utilizing Python and downloading spyder, pandas etc. that I need to learn for work.
In trying to install Anaconda on my Windows PC, I am getting an error
enter image description here. Basically, it says that if I want Anaconda registered as my system Python, that I unregister this earlier Python first. This earlier Python was installed as a default part of the Pymol program installation package, which I use for structural analysis.
Based on reading the one question that has asked this on stack exchange in the past, it sounds like this means that python has already been integrated on my Windows and now when I try to code, the system will need to figure out whether I would like to do so in the Anaconda environment or with the non-anaconda Python. My questions are a) how do I unregister this other python? b) should I just uninstall the whole Pymol program (and with it, the python)? c) If I say "ok" to this prompt and download Anaconda, will this cause problems with my existing Python installation or will it not matter in the end?
I also tried emailing Anaconda support a few times before realizing that they don't provide individual support unless you're an enterprise user.
Would appreciate any and all advice on this issue so I can move forward. Thanks very much.
You don't need to unregister your previous PYTHON installation. Edit your SYSTEM PATH should fix this. In case your anaconda is before your other python installation, or remove your older Python for it at all. How to set your PATH ?, check hier:

Setting up python 3 environment in Windows the easy way: just install from python.org, or would one really benefit from miniconda or similar?

I want to help a friend set up the environment for Python 3 in Windows 10 in a quick and easy way. I know that you can just download Python 3 for Windows from python.org and it already comes with Pip by default. I assume that then all you need is an editor and you're good to go, or does this Windows installation lack something essential, like the ability to use command line or something else?
Many people seem to recommend miniconda, but I don't understand what would be its benefit compared to the above method. I just want to get my friend ready to learn and code python with minimal amount of extra hassle in the beginning. Pip will be needed but don't need any pre-installed libraries.
I installed so many different environments in the beginning myself (for example the above method, Winpython, Anaconda, etc.) that I'm not sure which one of them was actually needed and would've sufficed by itself.
A very bare-bones install would be to get an uncluttered editor, then just install python from python.org.
I would actually advise against this unless you're only planning on using python a couple of times. As soon as you start using new packages or versions, a proper editor and environment handler becomes really important.
Pycharm does very well at handling conda and virtual environments and allows you to do it through the GUI which is good for people new to programming. You can select packages through the GUI and create environments for different projects very easily; importantly, it's also easy to remove them again. You can even pip/conda install packages through pycharm's terminal if you want to demonstrate the different installation methods.
The following things are necessary to know before knowing about package management tool
Python is interpreted language and its interpreter is written mainly in C programming language
You can write python libraries in the Python programming language or another programming language one I know isLLVM
Any code that you write using any compiled language like C, C++, or Java can be integrated or imported into another Python script. This code is considered as an "extension."
These libraries written in other programming language does not have what so called setup.py these package management tools handle dependencies with its own virtual environment mechanism
This is blog for writing extensions in c or c++ programming language Check here
so these package management tool tries to do more than what pip does handle Python dependencies as well as dependencies written in another programming language because these pacakage you install does not goes into site-packages
Starting Python pip is good
Mastering Python choose any package management alongwith pip

How to install pip for a total newbie

I have read a bunch of posts here and on Google, but my question is far more basic than the answers: If Python(2.7) came pre-installed on my MacBook Pro (High Sierra), can I just do sudo easy_install pip (as suggested) from the command line--withOUT causing issues? I have a vague understanding of global/local installations, and my understanding is certain Python installations aren't compatible with local/global kernel installations. I hope I am getting the terminology right, but I saw several warnings about installing pip for "a homebrew based python installation", but I am not sure whether Python on my laptop is installed via homebrew (nor how to find out).
My question came about because I wanted to install the Hydrogen package to use in Atom, the text editor (to help me learn Python). I finally succeeded in installing Hydrogen, but got stumped by the missing kernels (not sure which ones I need, so I am willing to install them all). But I can't seem to install the kernels without pip. So here I am.
My apologies for asking such a basic question--and thanks!
The rule of thumb is: If your operating system has a package manager, use it.
Unfortunately, MacOS is the only UNIX-like operating system that does not come with a decent package managment system.
(There is the app store, but that is useless for a lot open source software for several different reasons. It's also a walled garden.)
You have several choices (in descreasing suitability):
Use one of the package managers available for MacOS. Which one is the best choice for you depends on all the packages you need being available.
Use a Python distribution. I've used Anaconda on ms-windows, and that has saved me a lot of hassle. A good choice if you are only looking for Python and related libraries.
Build everything yourself. This can be very time-consuming and is a duplication of effort. You will learn a lot though.
I would second Piinthesky's comment that you install Python 3.6. Python 2.7 is now a legacy version.
Well although I am no Mac expert I've given it a shot anyway:
Yes you could but do you really want to risk it (or even do it)?
Mac-OS must rely on Python to fulfill something in the OS otherwise it would not come inbuilt. This means two things:
The Python installation will be minimal. By that I mean it will have things missing (any large library for a start). They will do this mainly to cut down on the OS size. Therefore you will not have the full Python library and in the long term you may end up missing out.
Second if anything went wrong (IE you broke your installation or even modified it -yep I've done this in Linux and have ended up factory resetting) then you may cause something to stop working and may need to factory reset or perform some other drastic action on your OS. A separate installation would prevent your from risking this. This is very useful because there comes a time when you may decide to update certain modules with pip and find it can't or it updates something that you shouldn't be messing with.
Yes it's possible you may run into compatibility problems but I think it's most widely accepted that you do not use the inbuilt one as it needs to remain unchanged if the OS is to use it correctly. Messing with it increases the chances of it breaking.
Conclusion: So even though installing modules with pip (and getting pip) can be done with the inbuilt Python it comes down whether you want to risk harming your OS. I strongly suggest you get a separate installation and leave the inbuilt one as it is. Second as you mentioned you will find that the inbuilt versions are never up-to-date or are built were they are not really compatible with standard libraries (expect things like the missing runtime libraries all the time) , just another reason to stay clear of them.
This is how I solved this problem-for those newbies who just want Hydrogen to work:
Installed Python 3 (instead of messing around with Python 2.7 and pip).
Followed instructions here (https://packaging.python.org/tutorials/installing-packages/#ensure-you-can-run-pip-from-the-command-line) for 'get-pip.py'.
In Atom, cmd+shift+p to bring up the packages menu, clicked on 'Hydrogen Run', which gave me the errors again.
Copied the code from the warnings and installed the kernels needed (via the command line).
Hydrogen is now working.
Thanks for all the tips!

How is Anaconda related to Python?

I am a beginner and I want to learn computer programming. So, for now, I have started learning Python by myself with some knowledge about programming in C and Fortran.
Now, I have installed Python version 3.6.0 and I have struggled finding a suitable text for learning Python in this version. Even the online lecture series ask for versions 2.7 and 2.5 .
Now that I have got a book which, however, makes codes in version 2 and tries to make it as close as possible in version 3 (according to the author); the author recommends "downloading Anaconda for Windows" for installing Python.
So, my question is: What is this 'Anaconda'? I saw that it was some open data science platform. What does it mean? Is it some editor or something like Pycharm, IDLE or something?
Also, I downloaded my Python (the one that I am using right now) for Windows from Python.org and I didn't need to install any "open data science platform".
So what is this happening?
Please explain in easy language. I don't have too much knowledge about these.
Anaconda is a commercial python and R distribution. It aims to provide everything you need (Python-wise) for data science "out of the box".
It includes:
The core Python language
100+ Python "packages" (libraries)
Spyder (IDE/editor - like PyCharm) and Jupyter
conda, Anaconda's own package manager, used for updating Anaconda and packages
Your course may have recommended it as it comes with these extras but if you don't need them and are getting on fine with vanilla Python that's OK too.
Learn more: https://www.anaconda.com/distribution/
Anaconda is a Python distribution that makes it easy to install Python plus a number of its most often used 3rd party libraries in a flexible way on a Windows or Linux machine.
My experiences with it are very positive, both on Windows and Linux. It is quite complete and avoids problems in building libraries that you need from source code, that frequently plague one by one installations of those libraries by tools like pip.
By the way: It's very wise to start with 3.5 or 3.6 since 2.7 is approaching the end of its lifecycle, though many applications still depend on it.
As for tutorials: Pythons own docs are quite suitable for learning the language.
https://docs.python.org/3/tutorial/
Anaconda is a Python-based data processing and scientific computing platform. It has built in many very useful third-party libraries. Installing Anaconda is equivalent to automatically installing Python and some commonly used libraries such as Numpy, Pandas, Scrip, and Matplotlib, so it makes the installation so much easier than regular Python installation. If you don't install Anaconda, but instead only install Python from python.org, you also need to use pip to install various libraries one by one. It is painful and you need to consider compatibility, thus it is highly recommended to directly install Anaconda.

Python development setup

So, id like to start serious python development, and its proven to be a big pain. Im not worried at all about the language itself; I like it well enough and I will have no problems picking it up. But the ecosystem is driving me crazy.
First I tried to get up and running under windows. I gave up on that after a few days, as 90% of packages dont include windows support / install instructions. So I switched to macosx, which people said was good for mac development.
More frustration ensues. Id like to use python as a matlab replacement and tool development platform, so spyderlib seems like an excellent tool. But now ive been busy trying to build pyqt on my mac for two days, to no avail, and im starting to question the wisdom of it all. Obviously, following several guides literally invariantly ends in cryptic errors. For which platform was this dependency built? What arcane compiler flags need to be set? I dont know and I dont care; why doesnt the installer figure it out? Oh wait, there isnt any... I want to USE these tools, not first completely reverse engineer them to find out how to build them.
There is a vast amount of implied knowledge in all the documentation I can find on these matters, both with regard to unix and pythonic quirks. Is there any way to scale this mountain, in a place with a managable learning curve? Right now I have no idea what im doing. Or should I go back to windows and try to coerce the unix packages I need into cooperation?
On Mac OS X, you can get spyder with macports. This should build everything needed.
If you prefer Windows, take a look at Python(x,y). It has a bunch of scientific tools pre-built, including spyder.
Finally, the Enthought Python distribution is worth considering for scientific work.
Have you tried ActivePython?
Why battle with compiling the modules yourself when you can get the pre-built packages from PyPM?
pypm install pyqt4 matplotlib scipy numpy
From my experience the best platform for kind of project you're describing is Linux. There you just install the libs you need from package manager and that's it. Binary packages, so compiling is not required.
If you want to stick with MacOS X, you should install either MacPorts or Fink. It's usually easy to use. Problem is, that things like Qt take forever to compile. But you won't be doing that very often.
As for installing Python modules, the best is PIP, which is very nice replacement for easy_install did does much more. Especially useful if you want virtualenv setup.
This is nearly the exact opposite of my experience with Python on Windows. Python itself installs with a binary installer, most add-on packages support easy_install, others provide binary installers of their own. The IDE I use is SciTE, which uses the old DOS install model - copy the files to a directory and run the SciTE.exe file. If you get a source distribution of a Python package, go to the directory containing setup.py and run python setup.py install. Maybe that's the implied knowledge you're talking about.
You can also find many unofficial Windows binaries at http://www.lfd.uci.edu/~gohlke/pythonlibs/.
I switched to Mac a few years ago and found that it took me quite a while of googling to properly install all the packages I needed for Python development. While I installed everything I made a list of the steps required to setup a functional system that may be appropriate for you as well. I usually use NetCDF4, HDF5, Numpy, Matplotlib, f2py, and Fortran in combination with Python. I published my list of 22 setup-steps for installing from source on my website. Installing from source is somewhat more time-consuming than using macports and fink, but enables you to have a working environment that is optimized for your system.

Categories