Python Conda install old version of matplotlib keyerror linux3 - python

While trying to install the tool PrimerProspector from the development version (SVN trunk, as instructed here: http://pprospector.sourceforge.net/install/install.html) I tried creating a conda environment to resolve the dependencies in an elegant way (I am running an Ubuntu server 16.04.3 LTS machine with conda 4.4.8). The PyCogent and Numpy can easily be installed in the required version using pip install when the environment (with python 2.6) is activated. I have conda forge in my channels. However, when running pip install matplotlib==0.98.5.3 I run into the issue that there is no such version available (Could not find a version that satisfies the requirement matplotlib==0.98.5.3 (from versions: 0.86, 0.86.1, 0.86.2, 0.91.0, 0.91.1, 1.0.1, 1.1.0, 1.1.1, 1.2.0, 1.2.1, 1.3.0, 1.3.1, 1.4.0, 1.4.1rc1, 1.4.1, 1.4.2, 1.4.3, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 2.0.0b1, 2.0.0b2, 2.0.0b3, 2.0.0b4, 2.0.0rc1, 2.0.0rc2, 2.0.0, 2.0.1, 2.0.2, 2.1.0rc1, 2.1.0, 2.1.1, 2.1.2)). Additionally I get an InsecurePlatformWarning which is apparently common with an older Python distribution. Nevertheless, as the source was available I tried using pip to install from the tarball. This gives me the rather uninformative KeyError: 'linux3':
Complete output from command python setup.py egg_info:
============================================================================
BUILDING MATPLOTLIB
matplotlib: 0.98.5.3
python: 2.6.9 | packaged by conda-forge | (unknown, Apr 29
2017, 15:44:38) [GCC 4.8.2 20140120 (Red Hat
4.8.2-15)]
platform: linux3
REQUIRED DEPENDENCIES
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-7ZwjL5-build/setup.py", line 99, in <module>
if not check_for_numpy():
File "setupext.py", line 497, in check_for_numpy
add_base_flags(module)
File "setupext.py", line 319, in add_base_flags
[os.path.join(p, 'include') for p in basedir[sys.platform] ])
KeyError: 'linux3'
----------------------------------------
Directly running setup.py after untarring also renders the same error. Does anyone know how to resolve this? Is there anything I can do to find out?

The mathplotlib version you're trying to use has been released years before the release of Linux 3.0. That's why it has no support for sys.platform='linux3'. And the Python version you're using is older than 2.7.2, which dropped setting the linux3 value.
You can try to just edit the setupext.py file in the tarball, and in the dict basedir add config for linux3, which would be the same as for linux and linux2.

Related

RStudio discovers Python pyenv installation, but I'm unable to run Python processes

I'm trying to run Python in RStudio. I have installed Python 3.8.5 via pyenv, and created a virtual environment with pyenv virtualenv (which I call venv-Rstudio) in my RStudio project folder. Based on the instructions given here, I think I have correctly managed to indicate to RStudio which Python environment to use:
>Sys.setenv(RETICULATE_PYTHON="/Users/my_username/.pyenv/versions/venv-Rstudio/bin/python")
> py_discover_config()
python: /Users/my_username/.pyenv/versions/3.8.5/envs/venv-Rstudio/bin/python
libpython: [NOT FOUND]
pythonhome: /Users/my_username/.pyenv/versions/3.8.5:/Users/my_username/.pyenv/versions/3.8.5
version: 3.8.5 (default, Oct 1 2020, 21:50:37) [Clang 12.0.0 (clang-1200.0.32.2)]
numpy: /Users/my_username/.pyenv/versions/3.8.5/envs/venv-Rstudio/lib/python3.8/site-packages/numpy
numpy_version: 1.18.5
When trying to call Python, I get the following error:
> py_config()
Error: Python shared library not found, Python bindings not loaded.
Use reticulate::install_miniconda() if you'd like to install a Miniconda Python environment.
I suspect this has something to do with libpython: [NOT FOUND] seen above, but I have made sure libpython is installed in the venv-Rstudio virtual environment:
(venv-Rstudio) my_username#MBP15 Rstudio % pip list
Package Version
---------------------- ---------
...
Keras 2.4.3
Keras-Preprocessing 1.1.2
libpython 0.2
Markdown 3.2.2
multidict 4.7.6
numpy 1.18.5
...
Any ideas what I might be missing and how to fix this? I'm running macOS 10.15.7 Catalina, RStudio 1.3 with R version 4.0.2.
After posting my question, this question appeared in the Related list, and this answer by #nucholab solved my problem. In short, re-installing Python with pyenv using the following command enables shareable libraries:
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.8.5
After that and re-creating my virtual environment (and for the record, installing numpy), loading Python in RStudio works as expected:
> py_config()
python: /Users/my_username/.pyenv/versions/3.8.5/envs/venv-Rstudio/bin/python
libpython: /Users/my_username/.pyenv/versions/3.8.5/lib/libpython3.8.dylib
pythonhome: /Users/my_username/.pyenv/versions/3.8.5:/Users/andreas/.pyenv/versions/3.8.5
version: 3.8.5 (default, Oct 2 2020, 13:54:11) [Clang 12.0.0 (clang-1200.0.32.2)]
numpy: /Users/my_username/.pyenv/versions/3.8.5/envs/venv-Rstudio/lib/python3.8/site-packages/numpy
numpy_version: 1.19.2
tensorflow: [NOT FOUND]
NOTE: Python version was forced by RETICULATE_PYTHON

Can not execute Robot Framework Properly (No module name Robot)

I had update Robot Framework into the newer version
Here are pip list that I had already download
Package Version
------------------------------- -----------
Appium-Python-Client 0.49
certifi 2020.6.20
chardet 3.0.4
decorator 4.4.2
django-robots 4.0
docutils 0.16
idna 2.10
kitchen 1.2.6
numpy 1.19.1
Pillow 7.2.0
pip 19.0.3
Pygments 2.6.1
PyPubSub 3.3.0
pywin32 228
requests 2.24.0
robot 20071211
robotframework 3.2.1
robotframework-appiumlibrary 1.5.0.4
robotframework-databaselibrary 1.2.4
robotframework-pythonlibcore 2.1.0
robotframework-requests 0.7.1
robotframework-ride 1.7.3.1
robotframework-selenium2library 3.0.0
robotframework-seleniumlibrary 3.3.1
robotframeworklexer 1.1
selenium 3.141.0
setuptools 40.8.0
six 1.15.0
urllib3 1.25.10
wxPython 4.0.7.post2
You are using pip version 19.0.3, however version 20.2.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Python that I chosen is 3.7.4
However, I need to executes the script, which it should be execute normally. However, I found that it caught error
Traceback (most recent call last):
File "d:\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "d:\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\Scripts\robot.exe\__main__.py", line 5, in <module>
ModuleNotFoundError: No module named 'robot'
that I don't understand that cause of error.
I have already got robot files as well
Have you found a solution yet? I doubt if your command to execute robot is correct.
robot <Path to robot file> will execute it.
for example robot Tests/my_robot_test.robot and if you have tags assigned, you can run specific tag test cases with robot -i <tag_id> Tests/my_robot_test.robot

Error when upgrading Spyder to 4.0.1: ModuleNotFoundError: No module named 'IPython.core.inputtransformer2'

I recently upgraded to Spyder 4.0.1 through Anaconda via conda update spyder. Now, when I try to boot up Spyder via Anaconda Navigator, the program automatically crashes with the following dump:
Traceback (most recent call last):
File "/Users/ed/anaconda/lib/python3.6/site-packages/spyder/app/mainwindow.py", line 3718, in main
mainwindow = run_spyder(app, options, args)
File "/Users/ed/anaconda/lib/python3.6/site-packages/spyder/app/mainwindow.py", line 3559, in run_spyder
main.setup()
File "/Users/ed/anaconda/lib/python3.6/site-packages/spyder/app/mainwindow.py", line 1010, in setup
from spyder.plugins.ipythonconsole.plugin import IPythonConsole
File "/Users/ed/anaconda/lib/python3.6/site-packages/spyder/plugins/ipythonconsole/plugin.py", line 52, in
from spyder.plugins.ipythonconsole.widgets import ClientWidget
File "/Users/ed/anaconda/lib/python3.6/site-packages/spyder/plugins/ipythonconsole/widgets/__init__.py", line 16, in
from .debugging import DebuggingWidget
File "/Users/ed/anaconda/lib/python3.6/site-packages/spyder/plugins/ipythonconsole/widgets/debugging.py", line 22, in
from IPython.core.inputtransformer2 import TransformerManager
ModuleNotFoundError: No module named 'IPython.core.inputtransformer2'
I couldn't find anybody with a similar error. I updated IPython, as someone suggested, but it did not resolve the problem. Any ideas?
... since none of this worked for me, here how I solved it:
check what IPython version you have via conda list
in my case i got a rather old version 5.8.0 instead of the most recent one
(at the time of writing 7.19.0... check available versions via conda search ipython)
since conda update ipython did not provide the most recent version, i decided
to manually run the command that installs the most recent version
(for me this was conda install -c conda-forge ipython=7.19.0)
that's it...
I had the same problem. Upgrading IPython via the following command line helped resolve the situation.
sudo conda update IPython -n xxx
where xxx is the name of the environment I was trying to run Spyder in.
I had this very same issue on Spyder 4.1.4. Turns out that not all the required packages were installed correctly when I installed Spyder.
I used the following in python to test IPython:
import IPython
print(IPython.__version__)
Turned out that I had 6.4.0 so I ran the following from the terminal:
!pip install --upgrade IPython
IPython 7.16.1 was installed with prompt_toolkit-3.0.5. I also got the following errors:
ERROR: spyder 4.1.4 requires pyqt5<5.13; python_version >= "3", which is not installed.
ERROR: spyder 4.1.4 requires pyqtwebengine<5.13; python_version >= "3", which is not installed.
ERROR: jupyter-console 5.2.0 has requirement prompt-toolkit<2.0.0,>=1.0.0, but you'll have prompt-toolkit 3.0.5 which is incompatible.
ERROR: spyder 4.1.4 has requirement jedi==0.17.1, but you'll have jedi 0.12.1 which is incompatible.
ERROR: spyder 4.1.4 has requirement parso==0.7.0, but you'll have parso 0.3.0 which is incompatible.
ERROR: spyder 4.1.4 has requirement qtconsole>=4.6.0, but you'll have qtconsole 4.3.1 which is incompatible.
ERROR: spyder-kernels 1.9.2 has requirement ipykernel>=5.1.3; python_version > "2", but you'll have ipykernel 4.8.2 which is incompatible.
ERROR: spyder-kernels 1.9.2 has requirement jupyter-client>=5.3.4, but you'll have jupyter-client 5.2.3 which is incompatible.
Installing the correct versions of the above packages in pip resolved my problem.
Update to python 3.7. I had the same problem. That solved it.
conda install python=3.7 anaconda=custom
I experienced the same problem. Just do conda update IPython. All good then!

Python Modules installing properly but dont exist in editors

I want to start with I am new to the python language and am learning on my own. My issue is that I am installing the modules that I'm trying to use. The installs are successful but do not exist when I try to import them. I am using Visual Studio Code, Python 3.6, and Anaconda on Windows 10.
I am trying to use pyttsx3, SpeechRecognition and pocketsphinx.
$pip list
This gives me a very large list but does not contain either of my installed modules.
$python -m pip list
Gives me smaller output with them.
Package Version
----------------- ---------
beautifulsoup4 4.6.0
bs4 0.0.1
certifi 2018.4.16
chardet 3.0.4
click 6.7
gTTS 2.0.0
gTTS-token 1.1.1
idna 2.6
pip 10.0.1
pocketsphinx 0.1.3 #Here
pypiwin32 223
pyttsx 1.1
pyttsx3 2.7 #Here
pywin32 223
requests 2.18.4
setuptools 39.1.0
six 1.11.0
SpeechRecognition 3.8.1 #Here
urllib3 1.22
wheel 0.31.0
I know their installed but when I try to use any of the imports.
$python
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyttsx3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pyttsx3'
I am fine with this being something small on my part due to my lack of knowledge with this language, but I have done a full days worth of research trying to solve this myself.
Edit:
$pip --version
pip 9.0.1 from C:\Users\Keiro\Anaconda3\lib\site-packages (python 3.6)
You have two versions of pip perhaps two different installations of python as well. One with Anaconda and other one by main site.
Stick to one version and if you install in that use that environment in Visual Studio(Or VS Code)
You have installed those in anaconda which the standard installtion of Python wont recognize..
Open Python prompt from Anaconda Navigator >> Choose the environment (Select base for default) >> Open with Terminal [Or Open with Python]
>>python
>>import pyttsx3
In Visual Studio code set the same environment
Ctrl+Shift+P >> Select Python interpreter
Choose the anaconda location.
Volla. Now it should work
I had the same problem and found the answer in an old forum.
Write "pip3" instead of "pip".
So the code is:
pip3 install pyttsx3
(Source: bash: pip: command not found)

pip displays incorrect version of package

I am not sure if this is a bug, or if I am doing something wrong.
The situation is the following,
pip list -o
yields a list of outdated python packages along with what is suppose to be the current installed version.
The issue is that I am pretty sure that it is giving me the wrong information on at least some packages as I can verify, as in the example below, that the version of ipython that pip thinks is installed (2.0.0) is not the one that I get when I run ipython from the command prompt (version==2.1.0).
kolmogorov:~# pip list -o | head -15
Warning: cannot find svn location for PEAK-Rules==0.5a1.dev-r2707
Warning: cannot find svn location for prioritized-methods==0.2.2dev-20110830
scipy (Current: 0.13.2 Latest: 0.14.0)
plotly (Current: 1.0.30 Latest: 1.0.32)
SOAPpy (Current: 0.12.21 Latest: 0.12.22)
openpyxl (Current: 1.8.6 Latest: 2.0.3)
networkx (Current: 1.8.1 Latest: 1.9)
setuptools (Current: 3.4.1 Latest: 5.1)
brewer2mpl (Current: 1.3.2 Latest: 1.4)
repoze.who (Current: 1.0.19 Latest: 2.2)
pandas (Current: 0.13.1 Latest: 0.14.0)
pygeocoder (Current: 1.2.2 Latest: 1.2.5)
ipython (Current: 2.0.0 Latest: 2.1.0)
tornado (Current: 3.2 Latest: 3.2.2)
Could not find any downloads that satisfy the requirement vboxapi
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 235, in main
return command.main(cmd_args)
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 156, in main
logger.fatal('Exception:\n%s' % format_exc())
File "/usr/lib/python2.7/dist-packages/pip/log.py", line 111, in fatal
self.log(self.FATAL, msg, *args, **kw)
File "/usr/lib/python2.7/dist-packages/pip/log.py", line 164, in log
consumer.flush()
IOError: [Errno 32] Broken pipe
kolmogorov:~# ipython
Python 2.7.7 (default, Jun 3 2014, 16:16:56)
Type "copyright", "credits" or "license" for more information.
IPython 2.1.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
My question is: Is there a way to have pip understand the correct version of the installed python packages?
You can run the following commands to see where the package is from:
which ipython
and:
pip show ipython
You may have two installations: one that was installed with pip install ipython and an installation via a separate tool (package manager on Linux or Ports/brew on Mac).
So the way to do this properly is a little bit more involved than what I anticipated, but I have to submit it as the proper answer as it actually resolves the issue.
Suppose the package version that is misunderstood by pip is pandas. So that the behavior you observe is that:
pip list --outdated
says that the version of pandas you have installed is 0.14.0; but when you inquire about the version of pandas in say ipython:
In [1]: import pandas
In [2]: pandas.__version__
Out[2]: '0.14.1'
In order to resolve this:
run pip show pandas; it should tell you about the location of the distribution, in my case /usr/local/lib/python2.7/dist-packages
redirect to that location cd /usr/local/lib/python2.7/dist-packages
run ls -lstrh pandas-0.14.*; you should see files associated with both your 0.14.1 version and the 0.14.0 one you want to get rid of
run rm -rf pandas-0.14.0*.egg-info pandas-0.14.0*.pth
That should be it!
pip show pandas
should now agree with what pandas.__version__

Categories