Open tbenst opened 1 year ago
I also need to add setup.py
in order for a local install to succeed, eg pip install -e .
to succeed. Is this expected behavior? Seems undocumented at best.
#!/usr/bin/env python
from distutils.core import setup
setup(name='Safari',
version='0.1',
description='Convolutions for Sequence Modeling',
url='https://github.com/HazyResearch/safari',
packages=['safari'],
package_dir = {'safari': 'src'}
)
Edit: it appears the issue is the use of the folder name src
. If I rename to safari
, then pip install -e .
succeeds, even without a setup.py
. Tutorial seems to suggest a bad folder structure..?
I think your Python environment is just not correct. Can you please show me the versions of everything and what OS you are on?
Certainly! Thanks for the response:
❯ python --version
Python 3.10.11
❯ pip --version
pip 23.1.2 from /home/tyler/opt/anaconda/envs/gaddy/lib/python3.10/site-packages/pip (python 3.10)
❯ which python
/home/tyler/opt/anaconda/envs/gaddy/bin/python
❯ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy
❯ uname -r
5.19.0-41-generic
❯ pip list | grep hatch
❯ pip list | grep safari
safari 0.1.0 /home/tyler/code/safari
Can you please show me a commit that I can try?
Found the same issue
Please show your config.
Ah. it's probably more my own misuse.
As you've mentioned here, for example, and from @jinq0123 comment above, I have learned that the sources and targets need to be configured correctly. And/Or your project needs a standard structure with a src/
directory.
I'm very new to this. My project had several filetypes within a directory that wasn't named src
, etc.
I was experimenting anyway and do not need to resolve, thanks @ofek !
I have this problem when using WSL (without remote connection)
Just in case somebody encounters a similar issue, I mistakenly added src/
in the .gitignore
(which is respected by hatch
) causing the src-layout
from the guide not to work properly - the pip install -e my-pkg
finished ok, but import my_pkg
failed with ModuleNotFoundError
. Removing the src/
from .gitignore
resolved this issue.
Following the tutorial at https://packaging.python.org/en/latest/tutorials/packaging-projects/, I created the following
pyproject.toml
:pip install -e .
works, as verified by$ pip list | grep safari
. However, unless I am in parent directory of package, when I runimport safari
I getModuleNotFoundError: No module named 'safari'
Presume I am missing something basic? I didn't have this issue in past with
setup.py
.