Comments (12)
To reproduce the issue, create the following python package:
- foo.py
import click
@click.group()
def bar():
pass
@click.command()
def message():
"""Display the current version."""
click.echo("Message!")
bar.add_command(message)
- setup.py
from setuptools import setup, find_packages
import utils
setup(name='testing-package',
version='0.0.2',
entry_points={
"console_scripts": ['bar = utils.foo:bar']
},
packages=find_packages(exclude=['contrib', 'docs', '*.tests'])
)
Directory structure:
C:\USERS\AMAN.GARG\TESTING-PACKAGE
│ setup.py
└───utils
foo.py
__init__.py
Error occurs when you run bar message
from conda-pack.
Hmmm, looks like the exe's provided by setuptools (e.g. things installed with pip) do need prefix rewriting, whereas those provided by conda packages don't (no absolute paths found in those). We currently don't do prefix rewriting for windows binaries, this would require some more work to handle. Is this a usecase that's important to you, and would you be willing/capable to submit a PR?
from conda-pack.
Yes, I would be willing to submit a PR. Could you guide me towards what needs to be done for handling the prefix for windows binaries?
from conda-pack.
I'm not really sure what needs to be done, I wasn't aware that any absolute paths existed in the launcher exes on windows (and am not sure why the difference between packages). I'd need to read more/experiment a bit to give better advice. If you feel like looking into things, the relevant code is here:
conda-pack/conda_pack/prefixes.py
Lines 100 to 104 in 52daedd
from conda-pack.
Thanks, I'll start probing into the code.
Are the prefixes expected to be set during the conda-pack step? Or with the conda-unpack script?
from conda-pack.
If a destination prefix is given, they should be replaced on packing, otherwise they should be recorded and fixed later in the conda-unpack
script.
from conda-pack.
I tracked the issue and the problem is with case-sensitivity, therefore replace_prefix
method should be changed to
def replace_prefix(data, mode, placeholder, new_prefix):
if mode == 'text':
data2 = text_replace(data, placeholder, new_prefix)
elif mode == 'binary':
data2 = binary_replace(data,
placeholder.encode('utf-8').lower(),
new_prefix.encode('utf-8').lower()
return data2
I changed both of placeholder and new_prefix to lower case and also remove the line:
conda-pack/conda_pack/prefixes.py
Line 84 in 52daedd
from conda-pack.
I tracked the issue and the problem is with case-sensitivity, therefore
replace_prefix
method should be changed todef replace_prefix(data, mode, placeholder, new_prefix): if mode == 'text': data2 = text_replace(data, placeholder, new_prefix) elif mode == 'binary': data2 = binary_replace(data, placeholder.encode('utf-8').lower(), new_prefix.encode('utf-8').lower() return data2I changed both of placeholder and new_prefix to lower case and also remove the line:
conda-pack/conda_pack/prefixes.py
Line 84 in 52daedd
I confirm that it works !!!
If there is no PR in process, I could create one with these changes
from conda-pack.
I have encountered this issue and manually applying #100 has worked as expected.
from conda-pack.
If you need to fix this in a CI pipeline, i used the following to make it automated:
-
get patch.py here https://github.com/techtonik/python-patch/blob/master/patch.py
-
create separate build environment, install conda pack there, and run build from there (i called the env "builder", change from below if needed)
-
apply patch in your #100 as below before packing (in your batch file)
bitsadmin /transfer condapackpatch /download /priority normal https://github.com/conda/conda-pack/commit/b55c186e42134a33aa585fbd4723010805091997.patch %cd%\conda-pack.diff || goto :error
@CALL python .\patch.py conda-pack.diff --directory=.\envs\builder\lib\site-packages
- run conda pack for needed environment(s) after this. The unpack command will then be patched for the packed envs.
from conda-pack.
Fixed by #122.
from conda-pack.
Hi there, thank you for your contribution!
This issue has been automatically locked because it has not had recent activity after being closed.
Please open a new issue if needed.
Thanks!
from conda-pack.
Related Issues (20)
- Conda pack does not work with Python 3.10 or 3.11 HOT 13
- `conda-unpack` cleanup prefixes not working HOT 1
- R/etc/ldpaths: No such file or directory HOT 3
- Permission error when packing to squashfs file on Linux HOT 2
- Lost my maintainer rights HOT 6
- Is it needed to run `conda-unpack` with squashfs ? HOT 2
- Deactivate script is deprecated and not available on mamba environments HOT 1
- Fix environment clobbered by pip by repairing conda-meta
- Add support for alternative compressors for mksquashfs
- [Governance] Access to Settings in this repo HOT 2
- conda-pack documentation is outdated
- Support for incremental migration of conda environments
- Conda-Managed Files Deleted or Overwritten HOT 2
- Absorb in `constructor` HOT 8
- Unversioned python in conda-unpack script shebang
- Unpacking to path containing whitespace does not work
- unpack to another writable dir
- add a .unpacked file in the env prefix folder to indicate that the unpack script is running or done
- Write a Wiki page to describe local execution of test suite
- Question about how conda pack works, why the pack step is necessary
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from conda-pack.