pipenv and Atom packages - atom-editor

I'm trying to download few Python packages for Atom with pipenv but Atom can't "see it". The pop-ups says it's not installed:
flake8==3.7.8
- entrypoints [required: >=0.3.0,<0.4.0, installed: 0.3]
- mccabe [required: >=0.6.0,<0.7.0, installed: 0.6.1]
- pycodestyle [required: >=2.5.0,<2.6.0, installed: 2.5.0]
- pyflakes [required: >=2.1.0,<2.2.0, installed: 2.1.1]
autopep8==1.4.4
- pycodestyle [required: >=2.4.0, installed: 2.5.0]
Clearly it is installed. What can I do ? Before you ask, I did restart the editor.

install one of Terminal packages for Atom, run it and then :
cd "the_path_to_the_directory"
pipenv shell python3(or python depending on your OS) name_of_your_script.py

Related

how to manually install the pre-build python package into conda environment

Need to install Azure cosmos-db python sdk via conda. But I can only install up to version 3.1.2 and 4.2.0 is needed in the project. I wonder how can I manually load the prebuild cosmo sdk in to the conda environment?
I have a env.yml file shown as follow, the enviroment is created via conda env create -f <path_to_env.yml>
name: cco_1410
channels:
- conda-forge
dependencies:
- azure-cosmos=4.2.0 (this would lead to fail)
- python=3
- fastapi=0.65.0
- pytest
install 4.2.0 version via conda is not possible. Conda is only able to install up to 3.1.2 version
conda search azure-cosmos
returns
/opt/miniconda3/lib/python3.9/site-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.2) or chardet (4.0.0) doesn't match a supported version!
warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
Loading channels: done
# Name Version Build Channel
azure-cosmos 3.0.2 py_0 conda-forge
azure-cosmos 3.1.0 py_0 conda-forge
azure-cosmos 3.1.1 py_0 conda-forge
azure-cosmos 3.1.2 py_0 conda-forge
azure-cosmos 3.1.2 py_0 pkgs/main
In lieu of someone fixing the Conda Forge feedstock so that the newer versions are available on Conda, it is a PyPI package, so one can also install it through Pip:
name: cco_1410
channels:
- conda-forge
dependencies:
- python=3
- fastapi=0.65.0
- pytest
- pip
- pip:
- azure-cosmos==4.2.0
Please read the Conda documentation on installing non-Conda packages.
Microsoft releases Azure SDK packages for conda every three months in Microsoft channel (https://anaconda.org/microsoft).
azure-cosmos 4.2.0 was included in Sep. release.
You can find it from https://anaconda.org/microsoft/azure-cosmos.
(I work in MS in the SDK team)

Issue installing R package 'devtools' in Docker - getting error installing git2r

I am using a continuumio/miniconda3:latest base container and activating a Conda environment.
This all works fine.
When I run:
RUN R -e "install.packages('devtools',repos = 'http://cran.us.r-project.org')"
I get an error:
configure: Package dependency requirement 'libgit2 >= 0.26.0' could not be satisfied.
-----------------------------------------------------------------------
Unable to find the libgit2 library on this system. Building 'git2r'
using the bundled source of the libgit2 library.
To build git2r with a system installation of libgit2, please install:
libgit2-dev (package on e.g. Debian and Ubuntu)
libgit2-devel (package on e.g. Fedora, CentOS and RHEL)
libgit2 (Homebrew package on OS X)
and try again.
If the libgit2 library is installed on your system but the git2r
configuration is unable to find it, you can specify the include and
lib path to libgit2 with:
given you downloaded a tar-gz archive:
R CMD INSTALL git2r-.tar.gz --configure-vars='INCLUDE_DIR=/path/to/include LIB_DIR=/path/to/lib'
or cloned the GitHub git2r repository into a directory:
R CMD INSTALL git2r/ --configure-vars='INCLUDE_DIR=/path/to/include LIB_DIR=/path/to/lib'
or download and install git2r in R using
install.packages('git2r', type='source', configure.vars='LIB_DIR=-L/path/to/libs INCLUDE_DIR=-I/path/to/headers')
On macOS, another possibility is to let the configuration
automatically download the libgit2 library from the Homebrew
package manager with:
R CMD INSTALL git2r-.tar.gz --configure-vars='autobrew=yes'
or
R CMD INSTALL git2r/ --configure-vars='autobrew=yes'
or
install.packages('git2r', type='source', configure.vars='autobrew=yes')
-----------------------------------------------------------------------
configure: Attempting configuration of bundled libgit2
checking size of void*... 8
checking for library containing inflate... no
configure: error: in `/tmp/Rtmpbkmfhr/R.INSTALL8c407eb001/git2r':
configure: error:
---------------------------------------------
The zlib library that is required to build
git2r was not found.
Please install:
zlib1g-dev (package on e.g. Debian and Ubuntu)
zlib-devel (package on e.g. Fedora, CentOS and RHEL)
and try again.
If the zlib library is installed on your
system but the git2r configuration is
unable to find it, you can specify the
include and lib path to zlib with:
R CMD INSTALL git2r --configure-vars='LIBS=-L/path/to/libs CPPFLAGS=-I/path/to/headers'
---------------------------------------------
See `config.log' for more details
ERROR: configuration failed for package ‘git2r’
* removing ‘/opt/conda/envs/r-app/lib/R/library/git2r’
I have libgit2-dev installed at the start of my Dockerfile using apt-get install libgit2-dev and it installs libgit2 version 0.27.7.
Now the odd part about this is if I start the container and access it, I can run the "install.packages('devtools',repos = 'http://cran.us.r-project.org')" just fine and it works.
Dockerfile:
FROM continuumio/miniconda3:latest
RUN apt-get update -y; apt-get upgrade -y; \
apt-get install -y vim ssh libgit2-dev zlib1g-dev \
build-essential gcc gfortran g++
RUN conda update -n base -c defaults conda
COPY environment.yml environment.yml
RUN conda env create -f environment.yml
RUN echo "source activate r-env" >> ~/.bashrc
ENV PATH /opt/conda/envs/r-env/bin:/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RUN R -e "install.packages('devtools',repos = 'http://cran.us.r-project.org')"
environment.yml:
name: r-env
channels:
- conda-forge
- defaults
dependencies:
- python=3.7
- r-essentials
- r-base
Replace the last line of your Dockerfile with:
RUN Rscript -e "install.packages('devtools',repos = 'http://cran.us.r-project.org')"

Failed to run IPython Notebook: bash: IPython: command not found

I've installed Ipython 6.0.0 successfully using Pip3:
pip3 install IPython
but when tried to run the command
Ipython
I got this error:
bash: IPython: command not found
This is the pip list result:
ipykernel (5.1.3)
ipython (6.0.0)
ipython-genutils (0.2.0)
..
..
notebook (6.0.2)
and this is the result of pip3 show IPython
Name: ipython
Version: 6.0.0
Summary: IPython: Productive Interactive Computing
Home-page: https://ipython.org
Author: The IPython Development Team
Author-email: ipython-dev#python.org
License: BSD
Location: /home/pi/.local/lib/python3.5/site-packages
Requires: setuptools, traitlets, jedi, pexpect, pygments, pickleshare, simplegeneric, prompt-toolkit, decorator
This is a problem of case sensitivity...
The correct typography is IPython.
pip is not case sensitive, see Is PyPI case sensitive?
IPython is installed as ipython (lowercase), as shown in your pip3 show IPython
bash is case sensitive...
So, just enter ipython.
As you have specified pip3, I would also recommend to invoke ipython3 to avoid python2/3 confusions.

RequestLibrary module not found

I need to use the RequestsLibrary library and when I import it:
*** Settings ***
Library SeleniumLibrary
Library RequestsLibrary
I get an error module not found. When I run pipenv graph I can clearly see it's installed:
(marek) bash-3.2$ pipenv graph
robotframework-requests==0.5.0
- requests [required: Any, installed: 2.22.0]
- certifi [required: >=2017.4.17, installed: 2019.6.16]
- chardet [required: >=3.0.2,<3.1.0, installed: 3.0.4]
- idna [required: >=2.5,<2.9, installed: 2.8]
- urllib3 [required: >=1.21.1,<1.26,!=1.25.1,!=1.25.0, installed: 1.25.3]
- robotframework [required: Any, installed: 3.1.2]
What am I doing wrong ?
As turned out the issue was the fact that I installed the library using pipenv install xyz and that creates brand new virtual environment prior to library installation. So I basically ended up with a virtual environment within virtual environment and Robot couldn't access it. As soon as I got rid off the extra virtual environment, exited out and ran pipenv install robotframework-requests outside of any venv, it ran.

Jupyter ImportError: cannot import name 'create_prompt_application' ubuntu 18.04

I have installed jupypter on Ubuntu 18.04. when I try to open .ipynb file it says trying to connect to server and fails eventaully.
When I looked at the console I saw the following error :
ImportError: cannot import name 'create_prompt_application'
as follows
[I 14:37:41.311 NotebookApp] KernelRestarter: restarting kernel (4/5), new random ports
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py", line 15, in <module>
from ipykernel import kernelapp as app
File "/usr/local/lib/python3.6/dist-packages/ipykernel/__init__.py", line 2, in <module>
from .connect import *
File "/usr/local/lib/python3.6/dist-packages/ipykernel/connect.py", line 13, in <module>
from IPython.core.profiledir import ProfileDir
File "/usr/lib/python3/dist-packages/IPython/__init__.py", line 49, in <module>
from .terminal.embed import embed
File "/usr/lib/python3/dist-packages/IPython/terminal/embed.py", line 18, in <module>
from IPython.terminal.interactiveshell import TerminalInteractiveShell
File "/usr/lib/python3/dist-packages/IPython/terminal/interactiveshell.py", line 20, in <module>
from prompt_toolkit.shortcuts import create_prompt_application, create_eventloop, create_prompt_layout, create_output
ImportError: cannot import name 'create_prompt_application'
[W 14:37:44.322 NotebookApp] KernelRestarter: restart failed
Some posts related to IPyton are suggesting that prompt-toolkit should be downgraded. I run deptree to get dependency tree as follows, which shows that prompt-toolkit 2.0.9 is installed and required version for jupyter-console should be between 2.0.0 and 2.0.1
- jupyter-console [required: Any, installed: 6.0.0]
- ipykernel [required: Any, installed: 5.1.0]
- ipython [required: >=5.0.0, installed: 5.5.0]
- pexpect [required: Any, installed: 4.2.1]
- jupyter-client [required: Any, installed: 5.2.4]
- jupyter-core [required: Any, installed: 4.4.0]
- traitlets [required: Any, installed: 4.3.2]
- python-dateutil [required: >=2.1, installed: 2.6.1]
- pyzmq [required: >=13, installed: 18.0.1]
- tornado [required: >=4.1, installed: 6.0.1]
- traitlets [required: Any, installed: 4.3.2]
- tornado [required: >=4.2, installed: 6.0.1]
- traitlets [required: >=4.1.0, installed: 4.3.2]
- ipython [required: Any, installed: 5.5.0]
- pexpect [required: Any, installed: 4.2.1]
- jupyter-client [required: Any, installed: 5.2.4]
- jupyter-core [required: Any, installed: 4.4.0]
- traitlets [required: Any, installed: 4.3.2]
- python-dateutil [required: >=2.1, installed: 2.6.1]
- pyzmq [required: >=13, installed: 18.0.1]
- tornado [required: >=4.1, installed: 6.0.1]
- traitlets [required: Any, installed: 4.3.2]
- prompt-toolkit [required: >=2.0.0,<2.1.0, installed: 2.0.9]
Any thoughts on what could be wrong and what should I do?
Thanks
It is best to upgrade jupyter-console with this command:
pip3 install --upgrade --force jupyter-console
Then it will be compatible with later versions of prompt-toolkit.
More details in this github issue.
sudo pip3 uninstall ipython
sudo pip3 install ipython
the error solved for me Try it out.
sudo pip3 install 'prompt-toolkit<2.1.0,>=2.0.0' --force-reinstall
For me the solution was to follow these steps:
python3 -m venv venv
source venv/bin/activate
pip install jupyter
python -m jupyter notebook
I hope this helps anybody.

Resources