ShuhuaGao / geppy

A framework for gene expression programming (an evolutionary algorithm) in Python
https://geppy.readthedocs.io/en/latest/
GNU Lesser General Public License v3.0
207 stars 76 forks source link

installation not working with python 3.7.4 #17

Closed tyker1 closed 5 years ago

tyker1 commented 5 years ago

Hi i wanted to use the gep so i tried to install your works, but got error and unable to install it:

ERROR: Could not find a version that satisfies the requirement geppy (from versions: none)
ERROR: No matching distribution found for geppy
cd geppy-master
pip install .

seems to work, but when i leave the folder where geppy placed, and use

import geppy as gep

i got the error:

>>> import geppy as gep
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\tyker1\AppData\Local\Programs\Python\Python37\lib\site-packages\geppy-0.1.0a0-py3.7.egg\geppy\__init__.py", line 37, in <module>
ModuleNotFoundError: No module named 'geppy.core'

it works and only works at the directory where the source file placed.

ShuhuaGao commented 5 years ago

Hi, it is very strange because the line 37 in __init__.py is standard relative import.

I just tested with Python 3.7 on Windows 10

(base) E:\GitHub\geppy>pip install .
Processing e:\github\geppy
Requirement already satisfied: deap in e:\github\deap\build\lib.win-amd64-3.6 (from geppy==0.1.0a0) (1.2.2)
Building wheels for collected packages: geppy
  Building wheel for geppy (setup.py) ... done
  Created wheel for geppy: filename=geppy-0.1.0a0-cp37-none-any.whl size=7978 sha256=a600542ee3dfaa41128f147076c1a6d0fdc15630c8d761961720ee89e6fbe044
  Stored in directory: C:\Users\GAOSHU~1\AppData\Local\Temp\pip-ephem-wheel-cache-vwapweig\wheels\79\56\f5\f561c5cfab112f241fcc6ae76e608275e6384470f145db74d8
Successfully built geppy
Installing collected packages: geppy
  Found existing installation: geppy 0.1.0a0
    Uninstalling geppy-0.1.0a0:
      Successfully uninstalled geppy-0.1.0a0
Successfully installed geppy-0.1.0a0

It works. Sorry, but I cannot figure out why it failed on Ubuntu.

Could you try pip install .e (i.e., install with the editing mode)?

tyker1 commented 5 years ago

oh well, (and im using Windows 10 too btw.) installation itself works, also the module works, but only when i'm in the same folder where also the geppy source located. when i leave the folder and try to import, it no longer be able to find the core modules.

I just checked your init.py it tried to find the core module in current path or the search path. Since i desired to run python in the folder where theres no geppy source to found it could only search in the pythons library path where i found no other files than a single folder with init.py in it and a python cache for the init, pip install .e dosen't work at all again, here are some outputs i got: Tried with pip install .:

PS C:\Users\LeweiHe\PowerFolders\Eigne\MasterProjekt\geppy-master> pip install .
Processing c:\users\leweihe\powerfolders\eigne\masterprojekt\geppy-master
Requirement already satisfied: deap in c:\python37\lib\site-packages (from geppy==0.1.0a0) (1.3.0)
Requirement already satisfied: numpy in c:\python37\lib\site-packages (from deap->geppy==0.1.0a0) (1.16.4)
Installing collected packages: geppy
  Running setup.py install for geppy ... done
Successfully installed geppy-0.1.0a0
WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

Tried with pip install .e and python setup.py install:

PS C:\Users\LeweiHe\PowerFolders\Eigne\MasterProjekt\geppy-master> pip install .e
ERROR: Invalid requirement: '.e'
WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
PS C:\Users\LeweiHe\PowerFolders\Eigne\MasterProjekt\geppy-master> python .\setup.py install
Warning: 'classifiers' should be a list, got type 'tuple'
C:\Python37\lib\site-packages\setuptools\dist.py:472: UserWarning: Normalizing '0.1.0a' to '0.1.0a0'
  normalized_version,
running install
running bdist_egg
running egg_info
creating geppy.egg-info
writing geppy.egg-info\PKG-INFO
writing dependency_links to geppy.egg-info\dependency_links.txt
writing requirements to geppy.egg-info\requires.txt
writing top-level names to geppy.egg-info\top_level.txt
writing manifest file 'geppy.egg-info\SOURCES.txt'
reading manifest file 'geppy.egg-info\SOURCES.txt'
writing manifest file 'geppy.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
creating build
creating build\lib
creating build\lib\geppy
copying geppy\__init__.py -> build\lib\geppy
creating build\bdist.win-amd64
creating build\bdist.win-amd64\egg
creating build\bdist.win-amd64\egg\geppy
copying build\lib\geppy\__init__.py -> build\bdist.win-amd64\egg\geppy
byte-compiling build\bdist.win-amd64\egg\geppy\__init__.py to __init__.cpython-37.pyc
creating build\bdist.win-amd64\egg\EGG-INFO
copying geppy.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO
copying geppy.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying geppy.egg-info\dependency_links.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying geppy.egg-info\requires.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying geppy.egg-info\top_level.txt -> build\bdist.win-amd64\egg\EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist\geppy-0.1.0a0-py3.7.egg' and adding 'build\bdist.win-amd64\egg' to it
removing 'build\bdist.win-amd64\egg' (and everything under it)
Processing geppy-0.1.0a0-py3.7.egg
Copying geppy-0.1.0a0-py3.7.egg to c:\python37\lib\site-packages
Adding geppy 0.1.0a0 to easy-install.pth file

Installed c:\python37\lib\site-packages\geppy-0.1.0a0-py3.7.egg
Processing dependencies for geppy==0.1.0a0
Searching for deap==1.3.0
Best match: deap 1.3.0
Adding deap 1.3.0 to easy-install.pth file

Using c:\python37\lib\site-packages
Searching for numpy==1.16.4
Best match: numpy 1.16.4
Adding numpy 1.16.4 to easy-install.pth file
Installing f2py-script.py script to C:\Python37\Scripts
Installing f2py.exe script to C:\Python37\Scripts

Using c:\python37\lib\site-packages
Finished processing dependencies for geppy==0.1.0a0

again, the problem isn't that pip install . command not working or python setup.py install not working but the installation only copys the init.py file without the module itself. Either it requires that the source code to be included in the search path by design, or something wrong with the setup.py so that it forget to copy the file into pythons site-packages

tyker1 commented 5 years ago

ok i figured it out for you, the problem do locate on your installation file setup.py, you have only told python to copy module geppy (where contains only init.py) but no submodules (which is critical in this situation since there are the true funcional modules)

in line 27 at setup.py u wrote:

packages=['geppy'],

which in this situation is wrong as mentioned in the Documentation

If you have sub-packages, they must be explicitly listed in packages, but any entries in package_dir automatically extend to sub-packages. (In other words, the Distutils does not scan your source tree, trying to figure out which directories correspond to Python packages by looking for init.py files.)

also i found a solution for u according to this post :

# coding=utf-8
import setuptools

try:
    with open("README.md", "r") as fh:
        long_description = fh.read()
except:
    long_description = '''geppy is developed for fast prototyping of gene expression programming in Python, and it is 
    built on top of the DEAP package.'''

setuptools.setup(
    name="geppy",
    version="0.1.0a",
    author="Shuhua Gao",
    author_email="nus.gao.shuhua@gmail.com",
    description="A package for gene expression programming in Python.",
    long_description=long_description,
    url="https://github.com/ShuhuaGao/geppy",
    classifiers=(
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: LGPL-v3.0 License",
        "Operating System :: OS Independent",
    ),
    keywords='gene expression programming',
    #packages=['geppy'],
    packages=setuptools.find_packages(),
    install_requires=['deap']
)

just notice the line packages=setuptools.find_packages(),

ShuhuaGao commented 5 years ago

Thank you for your efforts. I didn't notice this bug because it works on my own PC magically. Anyway, I just pushed the repair you suggested to the GitHub repository.