Installing linters on Atom using a MacBook - python

I am a beginner coder and have installed anaconda and atom on my MacBook. So far everything was working well - until I tried to install linters into Atom. I tried linter-flake8 first with the terminal using pip install flake8, next in atom I installed linter-flake8 and it’s dependencies. Still nothing was happening and no error highlights appeared even when I made deliberate mistakes in a python file. The same problem is happening with linter-pylint.
Can you please advise in the simplest way with basic steps I can take to solve this? Most of the solutions provided online are quite complex and I can’t understand them. Also most solutions center around windows operating systems.
Many thanks

First install this package https://atom.io/packages/linter
and you can use this second package for python language https://atom.io/packages/linter-python.
Otherwise you find all linter-package here.

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.

Trying to install packages with pip properly

This is a very vague question but I am really stuck. I have been working with python for a little bit to try and use some of their functions in opencv (cv2) and other open source libraries. But whenever I try and use pip I will always get an error about improper installation or more commonly when trying to import the installed package idle throws an error that a line of code in the library that is causing an exception. This does not just happen to one library but nearly all of them (I have tried stuff like opencv, tensorflow, urllib). I have tried reinstalling different versions of python (multiple times) and reinstalling it but none of that seems to work. I don't know what to do but really want to be able to use these tools. I use windows 10 and use the default "User" user on admin.
Any help on possible options would be most appreciated!
This was happening to me as well.
In my case I wanted to work with Anaconda and Spyder. I was following some books and tutorials saying how to install stuff with the pip and so on, but it didn't work. What solved it was to install PyCharm and use those same pip functions directly on the PyCharm console (not the windows cmd). Then everything worked automatically and I have whatever library I installed from PyCharm available at Spyder without doing anything else.
Summary:
Get Pycharm -> link
use the same pip install directly in the PyCharm console
A-Hopefully it will work
If it doesn't: Can you elaborate on which IDE are you using? Most likely there is someone here who can help you.

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!

Installing Python packages on Windows

I'm at a bit of despair.
I've spent the last two days trying to set-up a proper Python (2.7x) Windows enviornment.
I tried a bunch of different "bundles", and it boils down to this:
It's either I can't install the packages I want;
or I can't use the IDE I want.
I tried a simple install of "python" with no additions.
Very early, I come to a stop while using pip/easy_install, or exe files to install additional packages.
I then tried "Portable Python" which weathered much better.
It has a nice (though limited) bunch of packages.
I can use it with any IDE I want (usually PyDev/Eclipse).
Here too, It's practically impossible (for me, following what I read) to install most packages.
I then went with Enthought Canopy (formerly EPD).
This has a superb tool for package managing. I did not find any problem, with package handling.
However, it comes with a very limited (almost insulting) IDE.
All my actions to point eclipse interpreter to the Canopy directories, went awry.
Lastly, I tried WinPython.
This is somewhere in-between "Portable" and "Canopy".
It has more packages pre-bundled, than "portable" has, but less than canopy.
It also has a package management GUI, but unlike canopy's, this one fails.
Please, tell me how you set-up a Win/Python extendable enviornment.
And please, do not flag this as a duplicate - I have read dozens of related questions here on SO, and elsewhere. Non actually helped me.
I would not be wasting your times, unless I tried all paths before (obviously using SO and Google to solve my problems before going through another lengthy install).
[EDIT (SOLVED) ]:
I uninstalled everything, and then installed "plain" python.
I also manually removed all references to orphaned "pythons" of past from the PATH and PYTHONHOME env vars.
That seems to work.

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