cproctor / qualitative-coding

Qualitative coding for computer scientists
Other
12 stars 3 forks source link

Opening error after installation in Windows/conda environment #7

Closed vmussa closed 10 months ago

vmussa commented 4 years ago

Hello everyone,

I am unsuccessfully trying to run qualitative-coding on Windows in the conda environment described in the requirements.txt that is attached to this post. I reproduced the folllowing steps:

  1. Create a new conda environment: conda create -n qda
  2. Activate the newly created qda environment: conda activate qda
  3. Install pip in current environment: conda install pip
  4. Install qualitative-coding in current environment using pip: pip install qualitative-coding
  5. Try to run the package using the qc command in Anaconda PowerShell: qc init or simply qc -h
  6. A window pops up asking which software I want to use to run the script.

If I run python <path-to-qc> it works fine, so it seems to be some kind of PATH issue. I don't have any Python installation other than the Anaconda one, although I've had the python.org and the Microsoft Store ones in the past. The Anaconda folders (\anaconda3 and \anaconda3\Scripts are in the Windows PATH environment variables. Could it be an error in the script or is it being caused by the messy history of python installations and the way Windows handles it? For now I am improvising an alias to open the script without having to type the whole path every time. Thank you very much for your attention.

requirements.txt qc1 qc2

cproctor commented 4 years ago

Hi, thanks for the detailed bug report! I will say from the outset that I don't have experience developing on Windows so I may be clumsy in responding to the issue. However, my partner does have a Windows machine so at least I will be able to test. From what I can see, the problem you describe matches this post; it seems that I need to specify entry points in setup.py.

I'll try this tomorrow morning and see how it goes. If you get to it first, you can try editing setup.py as described in the post, and then run pip install -e . from the directory containing setup.py. This will do an "editable" install, which means pip will use the code in the directory.

If you get it working, I'd love a pull request. Thanks!

vmussa commented 4 years ago

Thank you for the guidance, @cproctor. If it is ok to you and if you haven't had the time to do it yet, I can try to do this later today (tonight in Brazil timezone) and, hopefully, do a pull request. I'm not an experienced developer at all, but I would like very much to try. So if I get stuck I'll probably ask you to do it instead. Thanks again.

cproctor commented 4 years ago

Hi, @vmussa, that sounds great--I will hold off, but will check this thread. If you get stuck, please let me know and I'll see if I can help. I did my first pull request last year, and it felt nice to contribute to open-source software!

vmussa commented 4 years ago

Hello again, @cproctor, I tried and tried to do it but I can't figure out what is going wrong. Basically, I read the post about python packaging for Windows you linked here and assumed the main() function in qc didn't need any changes. So I only commented the scripts=["qc"], line in setups.py and tried several combinations of entry_points dictionary arguments. I'm not sure if I understand the directory structure implied in this entry_points setuptools option. Anyway, first I got this error: "EntryPoint must be in 'name=module:attrs [extras]' format". Then, reading this Stack Overflow question, it seemed that the character - in qualitative-coding was the problem. So I changed the package name in setup.py to "qualitative_coding". I'm not getting this error anymore, but now I can't make the entry_points point to the main() function correctly. Any combination I try to guess ends in ModuleNotFoundError. The last thing I tried was:

entry_points = { "console_scripts": [ "qc = qualitative_coding.qc:main" ] }, which gives the following error when I try qc -h in PowerShell: ModuleNotFoundError: No module named 'qualitative_coding.qc'

I don't know if you have any thoughts on this. Maybe tomorrow I can try to understand the issue better.

cproctor commented 10 months ago

Since this discussion, I have moved to Poetry for packaging, including installation of CLI tools. I'm going to close this issue for now; will reopen if I hear new reports of installation issues. Thanks!