Can not import an already installed package module - python

I want to install a package called Xsequence https://github.com/fscarlier/xsequence
in Windows vie git clone command and then I used python to install it
git clone https://github.com/fscarlier/xsequence.git
cd xsequence_master
python setup.py install
I have several python versions installed, put the one that was used in the installation was in the first path.
C:\Users\musa\AppData\Local\Programs\Python\Python310\python.exe
C:\Users\musa\Anaconda3\python.exe
C:\Users\musa\AppData\Local\Microsoft\WindowsApps\python.exe
The issue is that when I import the package Xsequence it works fine,
But when I try to import any other module from inside this package it doesn't work
Python 3.10.2 (tags/v3.10.2:a58ebcc, Jan 17 2022, 14:12:15) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import xsequence
>>> from xsequence.lattice import Lattice
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\musa\AppData\Local\Programs\Python\Python310\lib\site-packages\xsequence-0.0.0-py3.10.egg\xsequence\lattice.py", line 11, in <module>
File "C:\Users\musa\AppData\Local\Programs\Python\Python310\lib\site-packages\xsequence-0.0.0-py3.10.egg\xsequence\elements.py", line 13, in <module>
ModuleNotFoundError: No module named 'xsequence.helpers'
I checked the package folder manually it contains the module Xsequence.helper.
The strange thing that all the module can be imported if I run python directly after instilling the setp.py but once I closed the terminal its not imported anymore

Related

Python 3.9.1 errors when attempting to import sqlite3

Please note that I am using pure Python and not something like Anaconda. Running on a new, updated Windows 10 machine with no virtual environment. After removing all previous Python installations, rebooting and performing a fresh install if Python 3.9.1. I run the python console and type:
import sqlite3
I receive the following error:
Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec 7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import sqlite3
Traceback (most recent call last):
File "", line 1, in
File "C:\Program Files\Python39\lib\sqlite3_init_.py", line 23, in
from sqlite3.dbapi2 import *
File "C:\Program Files\Python39\lib\sqlite3\dbapi2.py", line 27, in
from _sqlite3 import *
ImportError: DLL load failed while importing _sqlite3: The specified module could not be found.
I verified that the sqlite3.dll file does exist in C:\Program Files\Python39\DLLs
It was an environment issue. Previous builds (using Kivy) had left .pyd and .pyc files in the application directory and when we ran the application, python would try to load those and the files they reference, rather than using the proper files in the Python39 directory. As soon as we deleted those artifacts, the app ran fine (and sqlite loaded fine).

Python 3 cannot import socket in CMD but available in IDLE

I have installed python 3.7 on my computer. It seems not possible to import socket in CMD:
C:\Users\Sina\py
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python37-32\lib\socket.py", line 49, in <module>
import _socket
ImportError: Module use of python27.dll conflicts with this version of
Python.
>>>
But surprisingly, I am able to import socket in IDLE (Python 3.7).
I searched but didn't find any 'python27.dll' file in the installation directory
of python 3.7 (C:\Python37-32)
EDIT: There was a _socket.pyd file at "C:\Users\Sina" which used to make the confliction. I deleted it and the problem got fixed. Thanks to Aran-Fey!

python 2.7 cannot import geocoder library

Python 2.7.10 on win32. windows 8.1
used pip to install geocoder library https://pypi.python.org/pypi/geocoder/1.8.0
get this error when I try and import the library
>>> import geocoder
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "C:\Python27\ArcGIS10.4\lib\site-packages\geocoder\__init__.py", line 36, in <module>
from geocoder.api import get, yahoo, bing, geonames, mapquest, google, mapbox # noqa
File "C:\Python27\ArcGIS10.4\lib\site-packages\geocoder\api.py", line 29, in <module>
from geocoder.freegeoip import FreeGeoIP
File "C:\Python27\ArcGIS10.4\lib\site-packages\geocoder\freegeoip.py", line 6, in <module>
import ratelim
File "C:\Python27\ArcGIS10.4\lib\site-packages\ratelim\__init__.py", line 6, in <module>
from decorator import decorator
ImportError: No module named decorator
>>>
I thought just an install of the decorator library would fix the situtation but that library was already installed
C:\Python27\ArcGIS10.4\Scripts>pip install decorator
Requirement already satisfied: decorator in c:\python27\arcgis10.4\lib\site-packages
update
C:\Users\rizagha>python --version
Python 2.7.10
C:\Users\rizagha>python
Python 2.7.10 (default, May 23 2015, 09:44:00) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from decorator import decorator
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named decorator
something that may be complicating this is I have python 32 bit and 64 bit installed via arcgis...
Try running the following command to install the module
[root#server] python -m pip install decorator
This should install the module to the python library of the interpreter that starts when you run the python command
then try start up your interpreter again and try to import the module (assuming it doesn't say it's already satisfied)
[root#server] python
>> from decorator import decorator
>>
if it does say that it's already satisfied, then you can try to uninstall it using pip and then reinstall it by explicitly specifying the python -m command
[root#server] pip uninstall decorator
[root#server] python -m pip install decorator
then you can check to see if the module is available in your default interpretor
[root#server] python
>> from decorator import decorator
>>

Python : Module not found

When I use pip freeze command, it returns
C:\Users\Keshav Reddy>pip freeze
Warning: cannot find svn location for guippy===0.1.5dev-r0
beautifulsoup4==4.4.1
future==0.15.2
## FIXME: could not find svn URL in dependency_links for this package:
guippy===0.1.5dev-r0
keyboard==0.6.5
Pillow==3.1.1
PyAutoGUI==0.9.33
PyMsgBox==1.0.3
pypiwin32==219
PyScreeze==0.1.8
python-subprocess2==0.2.1
PyTweening==1.0.3
pywinauto==0.5.4
requests==2.9.1
robotframework==3.0
SimplePool==0.1
urlopen==1.0.0
virtualenv==14.0.6
but I couldn't import any of these modules.
C:\Users\Keshav Reddy>python
Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:38:48) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyautogui
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'pyautogui'
How can I import these modules?
Begin by installing a release of 'guippy' module.
Have you tried downloading Anaconda? It helps alot with downloading modules.

svn - python 2.5 - ImportError: DLL load failed

I have a python script for auto mailing when there is a commit in svn, but when i run the script it gives following error :
Traceback (most recent call last):
File "E:\AutoSms-Svn-Repo\test-repo-is\hooks\mailer.py", line 41, in <module>
import svn.fs
File "C:\Python25\Lib\site-packages\svn\fs.py", line 19, in <module>
from libsvn.fs import *
File "C:\Python25\Lib\site-packages\libsvn\fs.py", line 5, in <module>
import _fs
ImportError: DLL load failed: The specified module could not be found.
I even added required path variables for dependent dlls and python path
but still i get this message, even from command prompt
Thanks in advance
I got the same problem instaling subversion under Windows 7 for Python 2.7.
The solution is simple and has been tested. (but hard work to find and analize)
Download and install binaries from Subversion
Make sure thet binaries folder (default: c:\Program Files (x86)\subversion\bin) is in your PATH system
Download Python files from site mentioned in point 1 ( Subversion )
Extract libsvn and svn into Python's site-packages folder
Open cmd (Window's command line console) and type: python. Then try to import svn module.
It should looks like (no error occured):
C:\>python
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from svn import core
>>>

Categories