Pythonic pip freeze in Nim or how to list installed packages? - nim-lang

How to pip freeze command looks for Nim's package manager nimble ?

For freezing with nimble command :
nimble list --installed
or
nimble list -i

Related

How to Fix linter-Flake8 in atom for Python Configuration

Introduction
After I installed atom into my debian-ParrotOS for coding python. I've tried to search for flake8 for helping me to figure out the problems while writing code.
The Problem
after I installed linter-flake8 using this command: pip install flake8
It showed me that this line:
[Linter] Error running Flake8
See console for more info
What I've done
I tried several times to re-install linter-flake8. Even I tried to search multiple times for another alterative but all of them was not effcient as linter-flake8.
Fix Linter flake8
Description:
This's the solution for fixing the console problem which we're facing when we decide to install Linter-flake8 for Python3. It has been tested in Linux and Debian.
Why Linter-flake8 doesn't work after installation?
Linter-flake8 default installation meant to be for python 2.7 beside if you read the description of the package, you will also find that their implementation was for python 2.7 not for python3.
Default installation package simulates directly with python 2.7, not for python3. so, you have to install the package using the commands of python3.
Even after inserting your Executable PATH will be only mere of spectacular. Because you need to install flake8 in terms of python3, not python2.
So, What should I do?
Install Linter-flake8 From Atom and then restart your IDE.
Check if it's actually being installed via your package manager by executing: which flake8 in your terminal.
Reopen your IDE and click Ctrl+Shift+P to open the Search in Atom.
Search for Application: Open the Init Script.
Then, Write in the init.coffee this code:
process.env.PATH = ['usr/local/bin/', process.env.PATH].join(':')
Go To your *Executable PATH and paste this path /usr/local/bin/.
Then, open a new Terminal and execute these commands:
First, enter your root Mode by sudo su.
Second, go to cd /usr/local/bin/.
Third, execute these commands:
python3 -m pip install flake8.
ls
apm install linter-flake8
ls
python3 -m pip install flake8-docstring
python3 -m pip install hacking
If you didn't install pip before, then you can install it by sudo apt-get install pip and then, you can move on to continue the installation of flake8.
close your Atom and open it.
If you want to disable The Max Line Lenght you can do that by Default: 0.
Smile!
It will be a courtesy from you if you start following me :) <3
References:
flake8 not found
linter-flake8

Is it possible to exclude IDE packages from requirements.txt with pip freeze?

I use Visual Studio Code with its python plugins.
But I don't want these linter packages will be added to requirements.txt file.
Is it possible?
EDIT:
Explanation with an example:
The venv has three packages: django, requests, some_linter_package_for_vs_code.
When I run pip freeze >> requirements.txt I want to avoid adding some_linter_package_for_vs_code to the requirements.txt file
pipe the result of pip freeze to grep -v
pip freeze | grep -v linterPackage | grep -v otherPackage > requirements.txt
Be aware that the linter package depends on other packages and that some of your needed packages might also depend on them.
To find out which packages the linter depends on start a new virtual environment and only install the linter and get a pip freeze > lint.txt to see which packages you might need to filter off.
Maybe write a python script that will use the content of lint.txt to filter the result:
pip freeze | myFilterScript lint.txt > requirements.txt

Python3 wheel returns error : not a supported wheel on this platform

I would like to install wxPython/4.0.1
On this page all kind of wheel files are shown. I have Ubuntu 14.04 64 bit and Python 3.5 so I assume I should use wxPython-4.0.1-cp35-cp35m-win32.whl but this is not total clear to me.
The page lacks a simple full installation instruction.
#nepix32 helped me and shown the Linux version https://wxpython.org/pages/downloads/ and I have been pointing to https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-14.04/
apt-get
My preference is using apt-get, so I search on SO and found : Installing wxpython on ubuntu 14.04 and using travis-ci with wxpython tests
which both fails.
So I continue searching on wheel.
Install wheel
So I continue searching on wheel. On SO I found : How do I install a Python package with a .whl file?6
First I read https://stackoverflow.com/tags/python-wheel/info and https://pypi.python.org/pypi/wheel
Wheel seems not standard installed, so I downloaded the file wheel-0.30.0 and extracted it.
First I upgraded pip :
sudo pip install --upgrade pip
and then executed the setup.py in wheel :
sudo python3.5 setup.py install
which seems successful.
Try to install wxpython using wheel
Then I wanted to install the wheel file :
sudo pip install /home/hulsman/Downloads/wxPython-4.0.1-cp35-cp35m-win32.whl
I thought for python3.x pip3 should be used, instead of pip. All examples show pip. I tried both without success.
I tried also :
sudo -H pip3 install /home/hulsman/Downloads/wxPython-4.0.1-cp35-cp35m-win32.whl
All attemps returned almost the same error message :
wxPython-4.0.1-cp35-cp35m-win32.whl is not a supported wheel on this platform.
Using specific Linux version
I used
wxPython-4.0.1-cp35-cp35m-linux_x86_64.whl
but do not know the difference of the 'm' and the 'mu' version. The result is :
sudo pip install /home/hulsman/Downloads/wxPython-4.0.1-cp35-cp35m-linux_x86_64.whl wxPython
The directory '/home/hulsman/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/hulsman/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
wxPython-4.0.1-cp35-cp35m-linux_x86_64.whl is not a supported wheel on this platform.
hulsman#vbox11:~/Downloads$
and with the -H flag :
hulsman#vbox11:~/Downloads$ sudo -H pip install /home/hulsman/Downloads/wxPython-4.0.1-cp35-cp35m-linux_x86_64.whl wxPython
wxPython-4.0.1-cp35-cp35m-linux_x86_64.whl is not a supported wheel on this platform.
hulsman#vbox11:~
Check my environment
$ pip -V | grep -o "(.*)"
(python 3.4)
Pip points to Python3.4
$ pip3.5 install -i https://localhost --trusted-host localhost cffi==1.11.4
pip3.5: command not found
pip3.5 does not exist
$ python3.5 -c "import pip; print(pip.pep425tags.get_abbr_imp())"
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: module 'pip.pep425tags' has no attribute 'get_abbr_imp'
This fails. So I tried :
$ python3.5 -c "import pip; print(pip.pep425tags.get_abbr_impl())"
cp
So I tried to update pip :
~$ pip install -U pip
Requirement already up-to-date: pip in /usr/local/lib/python3.4/dist-packages
I tried to follow the suggestions in Install pip for python 3.5 of L. Martin, but without success.
with pip3 the behavior is the same.
Could you tell me what when wrong, and how can I solve this?
Installing wxPython in Linux is not as straightforward as Windows/OSX wheels because there are too many variants: distro, GTK2/GTK3 etc. But they do explain how to install it in Linux:
https://wxpython.org/pages/downloads/
Installing with a downloaded wheel
You already found the correct wheel (cp35m-linux_x86_64) in wxPython Extras, but you must install it with the targeted Python version. If you can't find pip for your target Python, just use the -m option of Python:
python3.5 -m pip install wxPython-4.0.1-cp35-cp35m-linux_x86_64.whl
Installing the usual way from pypi
The normal pip install method can work too, but for wxPython in Linux, that will try to build the wheel for you from the source archive - assuming you have all the dependencies. It will be inconvenient, and slow.
Again, you must run it with the correct targeted version of Python:
python3.5 -m pip install -U wxpython
Installing directly from wxpython.org wheels (recommended)
The easiest way is to get it directly from them:
python3.5 -m pip install wxPython -U --pre \
-f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-14.04
Or, if you just wanted to download the correct wheel to manually install later, and specifically wanted to target a specific python version, say 3.5:
pip download wxPython \
-f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-14.04 \
--only-binary=:all: \
--platform linux_x86_64 \
--abi cp35m \
--python-version 35 \
-d "${HOME}/pymodules/wxpython-py35-whl"
Change the distro in the url as needed. Note that the pip version is not important here.
The difference in 'm' and 'mu' is no longer relevant in Python 3. It was related to ucs2/ucs4 unicode build flags. If you were targeting Python 2.7 you would use the abi option to pick the 'mu' version like this: --abi cp27mu
Since pip 19.2 added a new debug command, these kinds of obscure issues may get easier to diagnose. That useless not a supported wheel on this platform message certainly didn't help anyone.

How to install library

I am a little bit confused....
I installed anaconda on my computer (I have windows 10).
Normally, when I want to install a package I simply do "pip install package_name" or "conda install package_name" and it is done.
First question: what is the difference between pip and conda?
Now I tried to install xgboost and it was really complicated I tried lot of things nothings worked until I install something called miniconda.
There it works but now, when I do "conda install package_name" it install it in miniconda3/lib/site _package and I have to copy/paste it in Anaconda3/lib/site_package if I want it to work.
Second question: how can I ask to the computer that "conda install
package_name" install it directly in anaconda3 and not miniconda3?
Finally I tried to install the package "surprise" for recommended systems. Both "pip install" or "conda install" failed.
I went in github and got the file "surprise" from https://github.com/NicolasHug/Surprise
I tried to copy it in Anaconda3/lib/site_package but it doesn't work.
When I do from surprise import Reader I did not get the error "no module name surprise" anymore but I get "cannot import name 'Reader'"
Last question: how can I make it work? I think I have to build it but
I do not now how...
Thank you in advance for anyone that can explain all this for me :-)
Similarly to you, I had issues installing the surprise package.
I tried both pip install surprise and conda install surprise unsuccessfully.
conda install -c conda-forge scikit-surprise
conda install -c conda-forge/label/gcc7 scikit-surprise
conda install -c conda-forge/label/cf201901 scikit-surprise
I found those on the anconda website and the first one worked for me.
Hopefully this would help you as well
pip vs conda
pip is a package manager that facilitates installation, upgrade,
and uninstallation of python packages. It also works with virtual python environments.
conda is a package manager for any software (installation, upgrade and uninstallation).
It also works with virtual system environments.
Conda is a packaging tool and installr that aims to do more than what pip does;
handle library dependencies outside of the Python packages as well as the Python packages themselves.
Conda also creates a virtual environment, like virtualenv does.
For more see here
Anaconda vs miniconda
The open source version of Anaconda is an easy-to-install
high performance Python and R distribution with a package manager,
environment manager and collection of 720+ open source packages.
It also comes with the options to install RStudio.
The "lite" version of Anaconda without the collection of 720 packages.
The downside is that you need to type in command line commands,
"conda install PACKAGENAME"
And Last
To install this package with conda run:
conda install -c anaconda py-xgboost=0.60
Update for surprise
The easiest way is to use pip (you'll need numpy):
$ pip install numpy
$ pip install scikit-surprise
Or you can clone the repo and build the source (you'll need Cython and numpy):
$ git clone https://github.com/NicolasHug/surprise.git
$ python setup.py install

pip not running with Python 3.5

I have installed Python 3.5 and Pip but When I am type pip or pip3 in console, i get this error
The folder you are executing pip from can no longer be found.
If I run pwd, I get
/home/zahid
Pip was installed using
sudo python /usr/local/lib/python3.5/site-packages/easy_install.py pip
and output that I got was
[sudo] password for zahid:
Searching for pip
Best match: pip 8.1.1
Adding pip 8.1.1 to easy-install.pth file
Installing pip script to /usr/local/bin
Installing pip3.5 script to /usr/local/bin
Installing pip3 script to /usr/local/bin
Using /usr/local/lib/python3.5/site-packages
Processing dependencies for pip
Finished processing dependencies for pip
Can anyone tell me what is going on here
which python3 returns
/usr/bin/python3
which pip returns
/usr/local/bin/pip
which pip3 returns
/usr/local/bin/pip3
echo $PYTHONPATH returns
nothing blank
Regards
Please close this terminal and open a new terminal. You may have deleted some files inadvertently. As a result the terminal is unable to locate some links or environment variables. I faced the same issue. In a new terminal everything went fine.
I had this error on my Mac and restarting fixed this problem for me.
Does sudo pip work?
If so, check to make sure your profile isn't messed up. Check your path variable using the echo command with something like echo $PATH
You need to make sure /usr/local/bin is present in your user profile.
If not, did you install pip into 3.5 and are you accidentally running some other version of python like python 2?
Create a symbolic link using
ln -s /usr/local/bin/pip /usr/bin/pip
test it by running
pip -V

Resources