site packages, python 3.8 - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: site packages, python 3.8 (/thread-23944.html) Pages:
1
2
|
site packages, python 3.8 - Dixon - Jan-23-2020 from setuptools import setup setup( name = 'vsearch' version = '1.0' description = 'The Head First PYthon Search Tools', author = 'HF Python 2e', author_email = '[email protected]', url = 'headfirstlabs.com', py_modules = ['vsearch'], )For reasons unknown to me, this doesn't fully work. I'm supposed to get a zip file in Windows 10, but get a tar.gz instead, which if I understand, is for the Unix OS. I invoke it with C:\users\dixon\appdata\local\programs\python\python38-32\mymodules\python setup.py sdist I'm supposed to now be able to access my modules from any file location on my computer, right? Again, this is from 'Head First Python', as would seem obvious from the code. RE: site packages, python 3.8 - buran - Jan-24-2020 What happens if you explicitly specify file formats in the cli with --formats option? The docs state that default format on windows is zip, but anyway it's worth a tryAs stated in the docs: Quote: In the simplest case, as a side note you can open tar files on widows RE: site packages, python 3.8 - Dixon - Jan-24-2020 (Jan-24-2020, 08:42 AM)buran Wrote: What happens if you explicitly specify file formats in the cli with OK, your tip works as far as getting the 'vsearch-1.0.zip' into the dist directory. So now I'm supposed to be able to access vsearch module from any location on my computer if I understand. Still a no go, and I can't find help online, nor does the book have anything to say about figuring out the error. RE: site packages, python 3.8 - buran - Jan-24-2020 (Jan-24-2020, 09:49 PM)Dixon Wrote: So now I'm supposed to be able to access vsearch module from any location on my computer if I understand.No that is source distribution (sdist), i.e. as the name suggests its for distribution. you need to install it with pip https://packaging.python.org/tutorials/installing-packages/#source-distributions-vs-wheels RE: site packages, python 3.8 - snippsat - Jan-24-2020 Use bdist_wheel so you get the real wheel format .whl .Example to 3.8 not in my Path so take in from Scripts folder,and call it vvsearch to avoid name conflict.# vvsearch.py def search4vowels(phrase: str) -> set: vowels = set('aeiou') return vowels.intersection(set(phrase)) def search4letters(phrase: str, letters: str) -> set: return set(letters).intersection(set(phrase)) if __name__ == '__main__': print(search4letters('hitch-hiker', 'aeiou')) print(search4letters('galaxy', 'xyz')) print(search4letters('life, the universe, and everything', 'o')) # setup.py from setuptools import setup setup( name="vvsearch", version='1.0', py_modules=['vvsearch'], description="Search Tool", url='https://python-forum.io/index.php', author_email='[email protected]', )Command line i use cmder,just the same in cmd # Install wheel C:\Python38\Scripts λ pip install wheel Collecting wheel Using cached https://files.pythonhosted.org/packages/00/83/...c9/wheel-0.33.6-py2.py3-none-any.whl Installing collected packages: wheel Successfully installed wheel-0.33.6 # Make the wheel C:\Python38\Scripts λ py -3.8 setup.py bdist_wheel .... adding 'vvsearch-1.0.dist-info/top_level.txt' adding 'vvsearch-1.0.dist-info/RECORD' removing build\bdist.win32\wheel # Now the wheel is in dist folder,install with pip C:\Python38\Scripts\dist λ py -3.8 -m pip install vvsearch-1.0-py3-none-any.whl Processing c:\python38\scripts\dist\vvsearch-1.0-py3-none-any.whl Installing collected packages: vvsearch Successfully installed vvsearch-1.0 # Test that it work C:\Python38 λ python Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import vvsearch >>> >>> vvsearch.search4letters('hitch-hiker', 'aeiou') {'e', 'i'} >>> vvsearch.search4letters('hello', 'aeiou') {'e', 'o'} >>> exit()So now it install to 3.8. This is just the same way you make it if want to use PyPi. PyPi is a central disruption of wheels .After upload wheel to PyPi your wheel get shorter name. # This can share with other eg usb stick,private host of wheel on web pip install vvsearch-1.0-py3-none-any.whl # PyPi share with other in an easier way pip install vvsearchIt's just the same wheel PyPi disturbed it central.
RE: site packages, python 3.8 - Dixon - Jan-27-2020 This is what I get when I follow instructions in the "Head First Python" book from page 182. If I'm supposed to format this in some specific way, I'm sorry. Anyway, now the computer can't find the 'pip' module. C:\Users\Dixon\AppData\Local\Programs\Python\Python38-32\mymodules\dist>python -m pip install vsearch-1.0.zip Traceback (most recent call last): File "C:\Users\Dixon\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 193, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\Dixon\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Users\Dixon\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pip\__main__.py", line 19, in <module> sys.exit(_main()) File "C:\Users\Dixon\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pip\_internal\main.py", line 45, in main command = create_command(cmd_name, isolated=("--isolated" in cmd_args)) File "C:\Users\Dixon\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pip\_internal\commands\__init__.py", line 96, in create_command module = importlib.import_module(module_path) File "C:\Users\Dixon\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 783, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "C:\Users\Dixon\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pip\_internal\commands\install.py", line 20, in <module> from pip._internal.cache import WheelCache File "C:\Users\Dixon\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pip\_internal\cache.py", line 19, in <module> from pip._internal.wheel import InvalidWheelFilename, Wheel File "C:\Users\Dixon\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pip\_internal\wheel.py", line 42, in <module> from pip._internal.utils.setuptools_build import make_setuptools_shim_args ModuleNotFoundError: No module named 'pip._internal.utils.setuptools_build' RE: site packages, python 3.8 - snippsat - Jan-28-2020 (Jan-27-2020, 11:10 PM)Dixon Wrote: This is what I get when I follow instructions in the "Head First Python" book from page 182Follow mine instruction they are more up to date. Dos your pip work now?From cmd ,it should work just the same for you but point to 3.8:# Test pip C:\>pip -V pip 19.2.3 from c:\python37\lib\site-packages\pip (python 3.7) # Test install,wheel as you need C:\>pip install wheel Collecting wheel Downloading ..... Successfully installed wheel-0.34.1 # Upgrade pip C:\>python -m pip install --upgrade pip Collecting pip ..... Successfully installed pip-20.0.2 # Test pip again,see that is 20.0.2 C:\>pip -V pip 20.0.2 from c:\python37\lib\site-packages\pip (python 3.7) RE: site packages, python 3.8 - Dixon - Jan-28-2020 Still having problems: C:\Users\Dixon>cd appdata\local\programs\python C:\Users\Dixon\AppData\Local\Programs\Python>cd python38-32\mymodules\dist C:\Users\Dixon\AppData\Local\Programs\Python\Python38-32\mymodules\dist>python -m pip install vsearch-1.0.zip Traceback (most recent call last): File "C:\Users\Dixon\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 193, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\Dixon\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Users\Dixon\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pip\__main__.py", line 19, in <module> sys.exit(_main()) File "C:\Users\Dixon\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pip\_internal\main.py", line 45, in main command = create_command(cmd_name, isolated=("--isolated" in cmd_args)) File "C:\Users\Dixon\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pip\_internal\commands\__init__.py", line 96, in create_command module = importlib.import_module(module_path) File "C:\Users\Dixon\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 783, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "C:\Users\Dixon\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pip\_internal\commands\install.py", line 20, in <module> from pip._internal.cache import WheelCache File "C:\Users\Dixon\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pip\_internal\cache.py", line 19, in <module> from pip._internal.wheel import InvalidWheelFilename, Wheel File "C:\Users\Dixon\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pip\_internal\wheel.py", line 42, in <module> from pip._internal.utils.setuptools_build import make_setuptools_shim_args ModuleNotFoundError: No module named 'pip._internal.utils.setuptools_build' C:\Users\Dixon\AppData\Local\Programs\Python\Python38-32\mymodules\dist> RE: site packages, python 3.8 - snippsat - Jan-28-2020 Could you do the same test as posted,also test pip and install wheel to see if that work. Then also in post #5 there is a complete setup to make wheel,and no use of .zip but .whl (the real wheel format).
RE: site packages, python 3.8 - Dixon - Jan-28-2020 I'll do it tomorrow. Time for Chardonay. :-) |