trouble with installing epdfree - python

I am trying to install epdfree on two virtually identical machines: Linux 2.6.18-308.1.1.el5, CentOS release 5.8., 64-bit machines. (BTW, I'm a bit new to python.)
After the install on one machine, I run python and try to import scipy. Everything goes fine.
On the other machine, I follow all the same steps as far as I can tell, but when I try to import scipy, I am told “ImportError: No module named scipy”.
As far as I can tell, I am doing everything the same on the two machines. I installed from the same script, I run the python in the epdfree installation directory, everything I can think of.
Does anyone have any idea what would keep “import scipy” from working on one machine while it works fine on the other? Thanks.

Well, turns out there was one difference. File permissions were being set differently on the two machines. I installed epdfree as su on both machines. On the second machine, everything was locked out when I tried to run it without going under "su". Now my next task is to find out why the permissions were set differently. I guess it's a difference in umask settings? Well, this I won't bother anyone with. But feel free to offer an answer if you want to! Thanks.

The problem is that you don't have the library scipy installed, which is a totally different library of epdfree.
you can install it from apt-get in linux I guess, or going to their website
www.scipy.org

Related

How do I configure Python and organise my interpreters?

Background:
I have been learning Python (on MacOS) for about three months now. I began by installing Python 3.7 through Anaconda and predominantly used Jupyter Notebook to write code. As I learnt more, I found out about different text editors and IDEs, and tried out different programs: IDLE, Sublime and PyCharm.
As I progressed I also learned about package management systems, such as pip and conda, and other such wonderful things that helped me achieve the things I wanted.
The Problem:
Problems surfaced after I installed PyCharm and Python 3.9.
My computer now has four or five different versions of Python installed (2.7, 3.7, 3.8, 3.9) - some which I seem to have downloaded multiple times - and now nothing works any more! The modules I have installed using pip don't load properly any more, my gorgeous programs (some of which are over 600 lines long) don't run any more - I can't even run a simple print('hello world') any more.
My files are a mess. I have probably over a 500mb of Python related junk that I don't use. I have tampered with PATHs and bins in the console, and I don't even know how to begin to sorting this out.
What I Want:
An ideal solution for me would be to just have PyCharm and Jupyter Notebook installed and for them to both be able to import the modules I have installed. I would also like to remove older versions of Python and just have both Jupyter Notebook and PyCharm use 3.9 as their interpreter. Additionally, I would like to safely delete all the junk files that I have collected over the last few months, though I understand that you might not be able to help me with that.
In short: I just want everything to work again!
I spent weeks writing a program that was basically finished and now doesn't even make it passed the second line without throwing out an error.
What can I try next? I am open to anything, including backing up my files and resetting my whole mac (though I'd like to reserve this as plan C).
I have solved my own problem but it took quite a bit of investigation, and will outline what I did:
Reset my Mac (this was not necessary but I wanted to do it anyway)
Install home-brew
Install pyenv
Install pipenv
For anyone experiencing the same problems, you should look definitely into pyenv and pipenv as a way of managing your Python versions and modules.
I won't go into too much detail, as plenty of other already have, but will post some links to some good articles that helped me:
https://opensource.com/article/19/5/python-3-default-mac
https://realpython.com/intro-to-pyenv/
https://pipenv-fork.readthedocs.io/en/latest/
Hope this helps.

How to locate MacPorts Python on my system?

The core question is: How can I find those pythons which were installed by MacPorts?
A bit more more information:
I installed a port from MacPorts which had both, python37 and python38, as dependencies.
I am now trying to find out where these distributions are installed, since I need to call respective scripts with those pythons. They wouldn't run if I use a different one which has already been on my system.
I found /opt/local/bin/python3.8, which I think was not there before. I am not sure though. This folder however does not contain a python3.7 as well.
My system has other distributions on it as well. Those which came with MacOS, and the one which came with Anaconda. I know where I can find the anaconda distribution, and I think the MacOS ones are in /usr/bin/, but I am also not 100% sure if all of those located there came with the OS, or if they may also contain the ones which were ported from MacPorts.
Thanks for help!
I would post a comment if I could (low reputation)...
Since I'm going through a similar situation at the moment, I thought about a few things that could help you (which can be obvious, but then again, posting them as a comment could be more appropriate.)
Yes, everything MacPorts-related is installed at /opt/local, usually. You can search there for any Python version. Some other points:
Perhaps since you already had Python 3.7 installed somewhere MacPorts didn't install it anew
Take a look at your $PATH environment variable. It will give you an idea of what's being searched for first.
You can always run something like sudo find / -type f -name "python*" to try and find anything Python-related (you don't strictly need sudo but it helps avoiding some annoying error messages). This way you will know which Python versions are installed where and by which distribution.
Oh, perhaps this can help too: port installed would show you everything MacPorts has installed. From here: See what has been installed via MacPorts

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 to fix python: pip and django won't work (pkg.resource not found) on OS X with home dir on a different drive

I have an issue with my system: I have a small ssd, so I decided to move home to a different drive.
Everything works fine, but I cannot use neither pip, django nor any other python application, beside python itself, since I get an error all the time, saying
pkg_resources.DistributionNotFound: pip==1.5.6
From what I can see, it is loading the application in /usr/local/bin/pip, but then I get errors about the distribution not found.
The path that is continuously printing in the error is /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py
I was searching online to figure out the problem, and I can't find a way to actually fix this, because none of the solutions found here and on other sites, works.
I think that it has something to do with my home directory saved in a different drive? Plus I am updating OS X since 10.6; which results in my python getting update every time and I have probably 4-5 different version of it.
Probably the paths are totally messed up; and I would like to know how to fix this (either nuking everything and re-installing python, pip and everything else, or just fixing the path).
I need to use Django and Pip, so would be great if you could give me some advice about what to look for and what to change. I do not have much experience with how python works on the OS that host it; I just make simple apps with it.
Ok, figured out:
1) moved anything in /opt/local to ~/local
2) did an edit in my profile (.bash_profile), removing any line that was adding PATH, like macports entry
3) Installed homebrew and then did a brew install python
4) once done, if I run Pip it works fine now.
No clue why; probably the install of python re-wrote the old PATH file and replaced it with a new one. Isee that the version that now I am running on Mavericks is 2.6.9.
Hope that this help someone else that may experience the same issue.

Spyder/Python install on MacOS - very frustrating

I have read through various posts here on the pros/cons of a wide array of Python environments. That being said, I am even more confused than prior to engaging in this due diligence.
My application is algorithmic trading, backtesting and analytical tool development and so I know I want the following functionality:
-numpy
-scipy
-Matplotlib
-spyder IDE
It seems like the installation of spyder on macos is non-trivial based on comments posted by users here http://code.google.com/p/spyderlib/wiki/Installation and so before I go down a rabbit hole I was wondering if someone could better guide me on the process and pre-requisites.
I came across the following post on stackoverflow, which seemed to indicate that I could just install the EPD-7.1 distribution and then install spyder separately but I'm not sure if the EPD distribution comes with all of the pre-requisites necessary for spyder.
Python distributions and environments for scientific computing
The following seems to be a guide on how to install spyder on macos but I'm not sure if this is current and whether installation of EPD makes some of the steps unnecessary.
http://works13.com/blog/mac/howto-install-spyder-1-x-on-mac-os-x-with-64bit-python.htm
Lastly, if I were to install EPD - is it better to go with 32-bit or 64-bit.
Thank you very much for your guidance.
Anaconda seems to be exactly what you're looking for: spyder, numpy, scipy, and matplotlib all work right out of the box.
The shortest path to a working analytic environment is the Enthought Python Distribution. The PythonXY build is also nice (easy to install, etc) but has fewer preinstalled features (a lighter footprint).
Spyderlib works cleanly with PythonXY. With EPD, there a couple of open issues:
http://code.google.com/p/spyderlib/issues/detail?id=627
http://code.google.com/p/spyderlib/issues/detail?id=723
I can't think of any reason to prefer a 32-bit build over a 64-bit build.
It depends on what kind of algo trading you intend to do but for anything that is time sensitive (such as actual trading) Python will likely be too slow. That said, it can be a good tool for backtesting and strategy development, although things like Streambase that can do everything might be a better choice.
I was in the boat as well. Too many options and too many opinions. I was also very much lost and to be honest, still feeling a bit soo! I am new to python and I am also not a proficient user of the terminal on Mac OS. Still, I managed to do the following to get spyder3 running on my new Mac running on High Sierra 10.13.4
Install Python3 using terminal Mac OS command:
$ brew doctor
$ brew install python3
(please note that my Mac OS High Sierra already had Python 2.x installed in it and I did not touch it. )
Then I installed Spyder using the recommended approach described here
https://github.com/spyder-ide/spyder/releases
Hope it helps!

Categories