1

I know this question has been asked before and their are references on this topic, but none of the instructions seem to work. I have a package titled PyFinances with the following directory structure and I am working on a Macintosh computer with the BigSur OS V11.1

PyFinances
|_PyFinances
|  |_ __init__.py
|  |_ finances.py
|_ data
|_ test
|_ scripts
|_ docs
|_ README.rst
|_ LICENSE
|_ setup.py
|_ Makefile
|_ requirements.txt
|_ .venv

The Makefile has the contents

init:
        pip3 install -r requirements.txt
test:
        pytest -s test

And the setup.py has the following contents

# -*- coding: utf-8 -*-

# Learn more: https://github.com/kennethreitz/setup.py

from setuptools import setup, find_packages


with open('README.rst') as f:
    readme = f.read()

with open('LICENSE') as f:
    license = f.read()

setup(
    name='PyFinances',
    version='0.1.0',
    description='develops a statistical estimate for the value of checking and savings account',
    long_description=readme,
    author='Jonathan A. Webb',
    author_email='[email protected]',
    license=license,
    packages=find_packages(),
    classifiers=[
        "Programming Language :: Python :: 3",
        "Programming Languate :: Python :: 3.9", 
        "Operating System :: MacOS",
    ],
    zip_safe=False,
)

I am trying to install my own code as a package on my system locally without uploading it to PyPi. I am working in a virtual environment and start by installing wheel with the following command when in the uppermost PyFinances directory.

pip3 install wheel

Then I install my package with the following command.

pip3 install .

The installer presents me with the message Successfully installed PyFinances-0.10, which makes me think everything worked fine. However, if I cd to a totally different directory and open the Python command line interface and type import PyFinances, or try to use a file that uses the same command, I get a ModuleNotFoundError. Can anyone tell me what is wrong with my process for turning my own Python code into a local install?

2
  • What do you get when you do a pip list in that venv? Commented Feb 7, 2021 at 17:37
  • @astrochun it shows all of the packages installed in the virtual environment to include PyFinances version 0.1.0. Commented Feb 8, 2021 at 2:06

1 Answer 1

1

After much investigating I found that I was using the wrong virtual environment, which prevented me from accessing my package. After changing to the correct .venv file it fixed the problem.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.