I've installed pymorphy2 using pip:
Requirement already satisfied (use --upgrade to upgrade): pymorphy2 in /usr/local/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): docopt>=0.6 in /usr/local/lib/python2.7/site-packages (from pymorphy2)
Requirement already satisfied (use --upgrade to upgrade): pymorphy2-dicts<3.0,>=2.4 in /usr/local/lib/python2.7/site-packages (from pymorphy2)
But when I'm trying to import this library in Python interactive shell I get this:
>>> import pymorphy2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/pymorphy2/__init__.py", line 3, in <module>
from .analyzer import MorphAnalyzer
File "/usr/local/lib/python2.7/site-packages/pymorphy2/analyzer.py", line 10, in <module>
from pymorphy2 import opencorpora_dict
File "/usr/local/lib/python2.7/site-packages/pymorphy2/opencorpora_dict/__init__.py", line 4, in <module>
from .storage import load_dict as load
File "/usr/local/lib/python2.7/site-packages/pymorphy2/opencorpora_dict/storage.py", line 24, in <module>
from pymorphy2.utils import json_write, json_read
File "/usr/local/lib/python2.7/site-packages/pymorphy2/utils.py", line 5, in <module>
import bz2
ImportError: No module named bz2
Ok, no problem:
sudo apt-get install libbz2-dev
And finally:
maestro#UIServer:~$ sudo apt-get install libbz2-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libbz2-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 64 not upgraded.
1 not fully installed or removed.
After this operation, 0B of additional disk space will be used.
Setting up python-pip (0.3.1-1ubuntu2) ...
Traceback (most recent call last):
File "/usr/bin/pycentral", line 2196, in <module>
main()
File "/usr/bin/pycentral", line 2190, in main
rv = action.run(global_options)
File "/usr/bin/pycentral", line 1478, in run
runtimes = get_installed_runtimes()
File "/usr/bin/pycentral", line 279, in get_installed_runtimes
default_version = pyversions.default_version(version_only=True)
File "/usr/share/pycentral-data/pyversions.py", line 172, in default_version
raise ValueError, "/usr/bin/python does not match the python default version. It must be reset to point to %s" % debian_default
ValueError: /usr/bin/python does not match the python default version. It must be reset to point to python2.6
dpkg: error processing python-pip (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
python-pip
E: Sub-process /usr/bin/dpkg returned an error code (1)
How to resolve this conflict with versions of python in my case?
Looks like you need to create a new symbolic link for python 2.6.
ln -sf /usr/bin/python2.6 /usr/bin/python
Related
So I've been using linux mint mate for a while, and everything was working fine.
So as I got a new notebook, I installed the new version of linux mint (19.2 - Tina) alongside the windows 10. Everything went right, I think.
Now, I'm trying to get it ready for use, and it's not working.
It supposedly came with both versions of python:
Python 2.7.15+
Python 3.6.8
But when I tried to run a simple hello world, but importing the essentials packages for me, something like this
import numpy as np
import math #as ma
import matplotlib.pyplot as plt; plt.switch_backend('agg')
import sys
import pandas as pd
import seaborn as sns; sns.set()
import powerlaw as pl
from itertools import zip_longest
import csv
import os
print('hello world')
It didn't even recognize the numpy package, and I got the following:
Traceback (most recent call last):
File "testes.py", line 1, in <module>
import numpy as np
ModuleNotFoundError: No module named 'numpy'
So I went to this website and tried following the tutorial
https://packaging.python.org/tutorials/installing-packages/#id18
But when I tried to install numpy the result was as bellow:
(tutorial_env) jheniffer#jheniffer-5480:~/Dropbox/teste_cros_bi$ pip install python3-numpy
Collecting python3-numpy
Exception:
Traceback (most recent call last):
File "/home/jheniffer/Dropbox/teste_cros_bi/tutorial_env/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/jheniffer/Dropbox/teste_cros_bi/tutorial_env/lib/python3.6/site-packages/pip/commands/install.py", line 353, in run
wb.build(autobuilding=True)
File "/home/jheniffer/Dropbox/teste_cros_bi/tutorial_env/lib/python3.6/site-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/home/jheniffer/Dropbox/teste_cros_bi/tutorial_env/lib/python3.6/site-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/home/jheniffer/Dropbox/teste_cros_bi/tutorial_env/lib/python3.6/site-packages/pip/req/req_set.py", line 554, in _prepare_file
require_hashes
File "/home/jheniffer/Dropbox/teste_cros_bi/tutorial_env/lib/python3.6/site-packages/pip/req/req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/home/jheniffer/Dropbox/teste_cros_bi/tutorial_env/lib/python3.6/site-packages/pip/index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/home/jheniffer/Dropbox/teste_cros_bi/tutorial_env/lib/python3.6/site-packages/pip/index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/home/jheniffer/Dropbox/teste_cros_bi/tutorial_env/lib/python3.6/site-packages/pip/index.py", line 568, in _get_pages
page = self._get_page(location)
File "/home/jheniffer/Dropbox/teste_cros_bi/tutorial_env/lib/python3.6/site-packages/pip/index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/home/jheniffer/Dropbox/teste_cros_bi/tutorial_env/lib/python3.6/site-packages/pip/index.py", line 795, in get_page
resp.raise_for_status()
File "/home/jheniffer/Dropbox/teste_cros_bi/tutorial_env/share/python-wheels/requests-2.18.4-py2.py3-none-any.whl/requests/models.py", line 935, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://pypi.org/simple/python3-numpy/
I don't know what should I do to get this running,
how should I proceed to install everything, because I thought that the basic packages, like numpy for example, was already installed, and every other time that I tried installing something by pip (on my previous laptop) it worked with just
pip3 install python3-numpy
I tried the option without pip, it installed successfully
(tutorial_env) jheniffer#jheniffer-5480:~/Dropbox/teste_cros_bi$ sudo apt install python3-numpy
[sudo] password for jheniffer:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
gfortran python-numpy-doc python3-dev python3-nose python3-numpy-dbg
The following NEW packages will be installed:
python3-numpy
0 upgraded, 1 newly installed, 0 to remove and 287 not upgraded.
Need to get 1.943 kB of archives.
After this operation, 10,9 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic/main amd64 python3-numpy amd64 1:1.13.3-2ubuntu1 [1.943 kB]
Fetched 1.943 kB in 4s (528 kB/s)
Selecting previously unselected package python3-numpy.
(Reading database ... 308507 files and directories currently installed.)
Preparing to unpack .../python3-numpy_1%3a1.13.3-2ubuntu1_amd64.deb ...
Unpacking python3-numpy (1:1.13.3-2ubuntu1) ...
Setting up python3-numpy (1:1.13.3-2ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
But when I tried to run the hello word code, I got this message again
(tutorial_env) jheniffer#jheniffer-5480:~/Dropbox/teste_cros_bi$ python3 testes.py
Traceback (most recent call last):
File "testes.py", line 1, in <module>
import numpy as np
ModuleNotFoundError: No module named 'numpy'
It looks like you may be using the apt package name in pip as opposed to the name of the PyPi package. First, check the default versions for pip and python on your system. This can be done using pip --version and python --version. If both are defaulting to Python 2.7 (which they very well might be), I would strongly recommend using Python 3.6 if possible, as Python 2.7 will reach EOL in 2020.
You can do this explicitly by using pip3 and python3 via the command line. To install numpy for Python 3, use pip3 install numpy. Keep in mind that this will only install it for Python 3, so if you spin up Python 2.7 interpreter, it will not be installed.
In the future, if you want to find the name of a PyPi package for install, you can do pip search {QUERY}, like pip search numpy for example.
When trying to install the module via pip, it says I need to install setuptools 18.5 or higher. So I do a "pip install -U pip" it upgrades my pip version to 10.0.1. Then when I try to install the pywinrm module, it breaks with a Syntax Error.
In fact, it breaks all Pip commands when upgrading to 10.0.1. I have it currently installed with version 7.1.0 and Python 2.6.6
I try this:
pip install pywinrm
Traceback (most recent call last):
File "/usr/bin/pip", line 7, in <module>
from pip._internal import main
File "/usr/lib/python2.6/site-packages/pip/_internal/__init__.py", line 42, in <module>
from pip._internal import cmdoptions
File "/usr/lib/python2.6/site-packages/pip/_internal/cmdoptions.py", line 16, in <module>
from pip._internal.index import (
File "/usr/lib/python2.6/site-packages/pip/_internal/index.py", line 526
{str(c.version) for c in all_candidates},
^รข
SyntaxError: invalid syntax
I've tried to install robotframework-selenium2library but taken a pkg_resources.VersionConflict error:
Downloading/unpacking robotframework-selenium2library
Downloading robotframework-selenium2library-1.8.0.tar.gz (118kB): 118kB downloaded
Running setup.py (path:/tmp/pip_build_root/robotframework-selenium2library/setup.py) egg_info for package robotframework-selenium2library
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/robotframework-selenium2library/setup.py", line 7, in <module>
from ez_setup import use_setuptools
File "/tmp/pip_build_root/robotframework-selenium2library/src/ez_setup.py", line 106
except pkg_resources.VersionConflict, e:
^
SyntaxError: invalid syntax
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/robotframework-selenium2library/setup.py", line 7, in <module>
from ez_setup import use_setuptools
File "/tmp/pip_build_root/robotframework-selenium2library/src/ez_setup.py", line 106
except pkg_resources.VersionConflict, e:
^
SyntaxError: invalid syntax
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/robotframework-selenium2library
Storing debug log for failure in /root/.pip/pip.log
Not so many packages have been already installed:
pip list
> apparmor (2.9.4)
> LibAppArmor (2.9.4)
> pip (1.5.6)
> pygobject (3.14.0)
> robotframework (3.0.2)
> robotframework-databaselibrary (1.0.1)
> selenium (3.4.3)
> setuptools (3.6)
python --version
> Python 2.7.12
Does anybody know how to resolve that issue?
The version of robotframework-selenium2library at PyPI (1.8.0) is rather old and supports only Python 2 while you're trying to install it with Python 3. Either use Python 2.7 or get the new code for the framework from GitHub.
I review the github Seleniumlibrary, and you can use:
pip install --pre --upgrade robotframework-seleniumlibrary
I just installed the Liblas with pip:
C:\Users\Geri>pip install liblas
Requirement already satisfied (use --upgrade to upgrade): liblas in c:\python27\arcgis10.2\lib\site-packages
Requirement already satisfied (use --upgrade to upgrade): setuptools in c:\python27\arcgis10.2\lib\site-packages (from liblas)
when I want to import the module, I got the following:
>>> import liblas
Runtime error
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Python27\ArcGIS10.2\lib\site-packages\liblas\__init__.py", line 2, in <module>
from core import get_version
File "C:\Python27\ArcGIS10.2\lib\site-packages\liblas\core.py", line 136, in <module>
las = ctypes.CDLL(lib_name)
File "C:\Python27\ArcGIS10.2\Lib\ctypes\__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found
Please help
My solution was to ensure that liblas.dll and liblas_c.dll were in the DLLs folder in all my python instances (I have python 2.7 in ArcGIS, OSGeo4W and WinPython).
I found the dll's in C:\Python27\ArcGIS10.2\DLLs after trying every method I could find for installing the liblas package (WinPython control panel, pip and installing using the exe from https://pypi.python.org/pypi/libLAS/1.6.0).
I have not tried using liblas via OSGeo4w as I am not sure where to put the dlls (I put them in the C:/OSgeo4w64/bin folder but that did not help) and OSgeo4w command_line package list in the installer tells me that liblas is not available. I also ensured that C:/OSgeo4w64/bin is in my path (as that was a suggestion above and elsewhere)... not sure if that helped.
All working fine now.
I'm trying to install the statsmodels, but I'm getting a dependency error that statsmodels requires patsy. However patsy is already installed:
Baby-Whip$ sudo pip install patsy
Downloading/unpacking patsy
Downloading patsy-0.3.0-py2.py3-none-any.whl (224kB): 224kB downloaded
Requirement already satisfied (use --upgrade to upgrade): numpy in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from patsy)
Installing collected packages: patsy
Successfully installed patsy
Cleaning up...
Then when I try to install stasmodels:
Baby-Whip$ sudo pip install statsmodels
Downloading/unpacking statsmodels
Downloading statsmodels-0.5.0.tar.gz (5.5MB): 5.5MB downloaded
Running setup.py (path:/private/tmp/pip_build_root/statsmodels/setup.py) egg_info for package statsmodels
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/private/tmp/pip_build_root/statsmodels/setup.py", line 463, in <module>
check_dependency_versions(min_versions)
File "/private/tmp/pip_build_root/statsmodels/setup.py", line 122, in check_dependency_versions
raise ImportError("statsmodels requires patsy. http://patsy.readthedocs.org")
ImportError: statsmodels requires patsy. http://patsy.readthedocs.org
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/private/tmp/pip_build_root/statsmodels/setup.py", line 463, in <module>
check_dependency_versions(min_versions)
File "/private/tmp/pip_build_root/statsmodels/setup.py", line 122, in check_dependency_versions
raise ImportError("statsmodels requires patsy. http://patsy.readthedocs.org")
ImportError: statsmodels requires patsy. http://patsy.readthedocs.org
Running pip freeze also lists patsy as an installed package. What am I missing here? Any help would be greatly appreciated.
See above comment for answer. Needed to install six, and run the statmodels install with the above workaround.
Sidenote: kill me