I have python2.7 and python 2.6 installed in my VM and I pip install some libraries such as:
sudo pip install gsconfig
The installation is successful and I can see that the package is installed by:
pip list
My default system's python is 2.6. In the terminal I enter python and try to import the library as:
python
import gsconfig
And then I get an error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named gsconfig
I also tried with python2.7 as:
python2.7
import gsconfig
I get the same error message. I can not understand why this is happening as I don't have with other packages this issue (e.g. simplejson).
Can it be that the location of the package is different?
When I try this:
which gsconfig
I get:
/usr/bin/which: no gsconfig in (/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
EDITED
Also when I go to the site-packages folder of python2.7 I can see that the package is installed.
It looks like the package name is not gsconfig, but is something else.
Looking at the documentation, I think it's geoserver.
Related
I recently downloaded Python 3.10 because I used 3.9. At first, everything worked fine. Sadly, I can't use installed libraries nor use newly downloaded ones, since I deleted Python 3.9. What can I do about this problem?
VSCode gives me this Error message:
Traceback (most recent call last):
File "e:\XXXX\XXXX.py", line 5, in <module>
from playsound import playsound
ModuleNotFoundError: No module named 'playsound'
You can check installed packages using this command:
pip freeze
or
pip list
Uninstall and install using command pip install <package-name>
I'm using python 2.7.18 on Windows, and i saw that ipaddress library was exclusively for python3 so i installed py2-ipaddress using pip. When i ran pip list into cmd, it shows py2-ipaddress as installed, but when i try import ipaddress into a python file i get this
Traceback (most recent call last):
File "C:/Users/x/Downloads/main (2).py", line 1, in <module>
import ipaddress
ImportError: No module named ipaddress
Why i can't import it?
EDIT :
Actually, ipaddress works fine on python2.7.x, or it should, i installed now ipaddress using pip install ipaddress, it shows as installed when running pip show ipaddress but i still can't import it
#Matthias was right. It seems that my pip doesn't work properly, or i don't know how to use it properly. One quick fix, if you're running pycharm or any IDE with a built-in terminal is to install the module via IDE's terminal using pip install <module>.
I recently tried to create my own pip package. I followed this guide, uploaded to pip. And after I install it python just returns error that module is not found, even if I type pip freeze, the module is installed there.
Also I tried to install it on my Windows pc (prev. machine is Ubuntu) and it doest't work there as well. Any tips?
EDIT:
https://pypi.org/project/PyColours/
The output:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyColours'
You named main directory PyColours_pkg so you need to
import PyColours_pkg
Or rename the directory to PyColours, increase version, recreate and reupload the package.
When i follow the website (https://www.kaggle.com/wiki/GettingStartedWithPythonForDataScience) and type python makeSubmission.py I get the following error message :
ImportError: No module named sklearn
I think I have already successfully installed the following:
Python 3.4 for windows
sciPy,NumPy and matplotlib
setuptools
scikit-learn
PyCharm
I then opened "Python 3.4 command line" and typed import sys; print(sys.__path__),but I got the message
Traceback (most recent call last): File "<stdin>", line 1, in <module>
AttributeError: module object has no attribute '__path__'
Anyone can help?
Looks like you haven't installed scikit-learn properly. pip install -U scikit-learn should do the job. Also, I would suggest downloading the Anaconda distribution of python if you're planning to use python for kaggle contests. It takes care of all the necessary dependencies and contains all the commonly needed python packages for the contest. I found that easier than the tedious download of the dependencies. Here's the Link
The Ubuntu 14.04 package is named python-sklearn (formerly python-scikits-learn) and can be installed using the following command:
sudo apt-get install python-sklearn
If you are using PyCharm or any other IDE, then you have to install 'sklearn' separately in PyCharm tool too. In My Case I am using PyCharm, select
File Menu-> Default Settings-> Project Interpreter -> Press + button and type 'sklearn'
Press install button. Installation will be done in 10 to 20 seconds.
2nd option is if you already installed 'sklearn' using terminal then you have to set path in your PyCharm IDE.
Depending on which installation of Python I am using I have some problems to load a module. When I type
from quantecon import approx_markov
in the terminal using Python 3.4.0, the following error message is returned:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.4/dist-packages/quantecon/__init__.py", line 6,in <module>
from asset_pricing import AssetPrices
ImportError: No module named 'asset_pricing'
In the folder /usr/... as referred to above, I do however find a module called asset_pricing. (I have to admit that I additionally do not understand why the module asset_pricing interferes.)
I installed quantecon with:
pip3 install quantecon
I suspect that the problems are related to the Python version I am using. I also installed
pip install quantecon
and when I call the module approx_markov form the terminal, using Python 2.7.6 (I think this is the standard Python version of the OS I am using) I do not receive any error message. To solve the problem I already followed the instruction in the following discussion but to no avail Python3 has no acces to python2 modules (ubuntu).
The currently released version of quantecon is not Python 3 compatible; it uses relative imports and these are not supported anymore in Python 3.
The version in the source repository has been refactored and updated, and looks like it'll work with Python 3. You'll need to install that version instead:
pip3 install -U git+https://github.com/jstac/quant-econ.git
where -U tells pip3 to upgrade the package.
Note that there have been a lot of changes recently; use at your own risk. You could stick with Python 2 and wait for an official release.