1

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

ely66
  • 175
  • 1
  • 11
  • What is your output for ```where python```? If I interpret "put the one that was used in the installation was in the first path" correctly, you think you are running python 3.10. However the traceback implies that the Anaconda python version is used; seemingly 3.9. How did you install Xsequence? – jrbergen Feb 15 '22 at 00:23
  • @jrbergen The result of where python is the following: 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 ...I installed xsequence using the following steps: git clone https://github.com/fscarlier/xsequence.git cd xsequence_master python setup.py install – ely66 Feb 15 '22 at 12:15
  • @jrbergen When i just type python in the cmd the python in the path C:\Users\musa\AppData\Local\Programs\Python\Python310\python.exe is open so i think its the one that i used in the installation – ely66 Feb 15 '22 at 12:18
  • I edited the post with the corresponding error – ely66 Feb 15 '22 at 12:20
  • I've donwloaded the repo and it worked here so it doesn't seem to be a system-independent issue with the code. Could you make sure you have `wheel` installed, and then run `python setup.py install` again? If you didn't have it installed before, this way python may use a different mechanism for building the package. Also; have you tried running it from a virtual environment instead of your system python? Python version management is a PITA, especially on Windows. – jrbergen Feb 15 '22 at 20:02
  • Although not a direct answer to your question, I would recommend something like [`pyenv`](https://github.com/pyenv/pyenv) combined with the [`pyenv-virtualenv`](https://github.com/pyenv/pyenv-virtualenv) plug-in. It requires a little initial setup on Windows if I recall correctly, but thereafter it makes it very easy to separate environments for projects, and rule out that some dependency conflict with another package causes these problems. It also makes the use of different python versions a breeze. – jrbergen Feb 15 '22 at 20:06
  • I followed your suggestion of installing wheel and reinstall the package again and it works now when i import the module but this is only when i open a terminal in the package installation directory, also in Pycharm the modules still not seen although the correct python is used as interpreter. @jrbergen – ely66 Feb 15 '22 at 21:41
  • You could also try installing with pip. For windows: `pip install --target=c:\path\to\where\you\cloned\xsequence_master xsequence`. Also; I recall that using both Anaconda and having Python installed via its normal installer could cause these kind of problems in the past, but I'm not sure if that's still true and the packages seem to be resolving the right directories. If this doesn't work, try installing it in a virtual environment (see [this](https://stackoverflow.com/a/41573588/8484932) for an overview; unfortunately Python version/dependency management isn't the most elegant currently). – jrbergen Feb 15 '22 at 22:55
  • Regarding the recommendation of `pyenv` above for using multiple python versions; I forgot that pyenv is focused on UNIX-like OSes and not windows, so you could use [`pyenv-win`](https://github.com/pyenv-win/pyenv-win) instead. – jrbergen Feb 15 '22 at 22:59
  • I didn't know you were using PyCharm. You might be able to create a new virtual environment from within it, and basing it on your system interpreter. See [PyCharm's guide](https://www.jetbrains.com/help/pycharm/creating-virtual-environment.html#python_create_virtual_env) on how to do this. – jrbergen Feb 15 '22 at 23:00
  • @ly66 If you don't need it elsewhere, it might be helpful to remove the manually downloaded Python versions and the microsoft store version, and just use Anaconda. Then try and install this package using `conda` as the package manager, given you seem to be using that already. – jrbergen Feb 15 '22 at 23:47
  • @jrbergen Thanks a lot i followed the suggestion of creating VM in Pycharm and it works well. I will try also the pyenv-win solution as well. – ely66 Feb 16 '22 at 14:07

0 Answers0