Getting ERROR: Directory '.' is not installable. Neither 'setup.py' nor 'pyproject.toml' found even if setup.py file available

See original GitHub issue

I tried to run my unit testcases through pre-commit (pre-push stage). But I’m not able to install local directory in virtualenv. Getting an error like “Directory ‘.’ is not installable. Neither ‘setup.py’ nor ‘pyproject.toml’ found” even if setup.py file available.

Here is my .pre-commit-config.yaml

repos:
  - repo: https://github.com/psf/black
    rev: stable
    hooks:
      - id: black
        language_version: python3.6
        stages: [commit]
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v2.3.0
    hooks:
      - id: flake8
        stages: [commit]
  - repo: local
    hooks:
      - id: unittests
        name: unittests
        entry: python -m tests.initiate
        language: python
        language_version: python3.6
        additional_dependencies: ['--trusted-host' ,'pypi.org' ,'--trusted-host' ,'files.pythonhosted.org']
        stages: [commit]

And finally, here’s the error I’m getting from pre-commit:

git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks commit -q -F C:\Users\xxxxx\AppData\Local\Temp\1t5bmasv.vpz
[INFO] Installing environment for local.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...

An unexpected error has occurred: CalledProcessError: Command: ('C:\\Users\\xxxxx\\.cache\\pre-commit\\reposrc_pe7u\\py_env-python3.6\\Scripts\\pip.exe', 'install', '.', '--trusted-host', 'pypi.org', '--trusted-host', 'files.pythonhosted.org')
Return code: 1
Expected return code: 0
Output: (none)
Errors: 
    ERROR: Directory '.' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.

Check the log at C:\Users\xxxxx/.cache\pre-commit\pre-commit.log

I have debugged the pre-commit code and changed pre_commit/languages/python.py#L171 for verification.

prefix, ('pip', 'install', Path.cwd())+ additional_dependencies

After this change, again I ran pre-push then the code in local directory installed in C:\Users\xxxxx\.cache\pre-commit\reposrc_pe7u\py_env-python3.6\lib\python3.6\site-packages

Can anyone please guide me on this. Please provide a solution

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:18 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
asottilecommented, Nov 13, 2019

probably because setup.* was unstaged (and never checked in)

0reactions
asottilecommented, Jun 8, 2021

@abbasabaei that’s unrelated entirely – this person had modified the pre-commit source and broken it and then reported the issue to github for some reason

I’m locking this because all comments after the original have been off topic – if you think you ahve the same issue please open a new issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Directory is not installable. Neither 'setup.py' nor 'pyproject ...
Does this work? You can create a new folder e.g. lib , and run this command: pip3 install <your_python_module_name> -t lib/.
Read more >
Directory '.' is not installable. Neither 'setup.py' nor 'pyproject ...
When I follow the below mentioned steps, I run into an error git clone https://github.com/asyml/texar.git cd texar pip install .
Read more >
Installation — Airflow Documentation
We decided to keep our dependencies as open as possible (in setup.cfg and setup.py ) so users can install different version of libraries...
Read more >
Configuring setuptools using pyproject.toml files
Starting with PEP 621, the Python community selected pyproject.toml as a standard way of specifying project metadata. Setuptools has adopted this standard and ......
Read more >
Directory '.' Is Not Installable. Neither 'Setup.Py' Nor 'Pyproject ...
We recommend using Python 3.5 but all the Python code in the carla Install the dependencies with pip using the requirements file provided...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found