Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local language support (LC_ALL) added to installation& launcher on macOS #1881

Merged
merged 7 commits into from
Jul 4, 2018

Conversation

random1717
Copy link
Contributor

@random1717 random1717 commented Jun 22, 2018

Requirements

  • [* ] Is there a issue open describing the motivation for this pull request ?
  • Does the pull request need an update of the documentation ?
  • [ *] Does the pull request need additional test(s) ?
    Tested on macOS
  • Clean up the warnings generated by the style guide

Description of the Change

Adding support for non-English language local Unicode during the installation.
Please note that LC_ALL overwrites LANG

Steps and Constraints

install_sct updated

Applicable Issues

Implements or Fixes #1880 and #1851 (duplicate)

@perone
Copy link
Contributor

perone commented Jun 22, 2018

We talked about that in Slack before, I don't think it's a good solution because it will be forcing English locale into users computers. It will instruct internationalized programs to use the English language even if their language isn't English.

@tanguyduval
Copy link
Contributor

@abtahizadeh the error appears during the installation (before writting/sourcing .bashrc).
you need to call export LC_ALL=en_US.UTF-8 in addition to writing it to bashrc

@random1717
Copy link
Contributor Author

@perone Didn't know about your previous discussion, I don't think there's other solution than this ... what should we do?

@tanguyduval thanks! update in progess

@zougloub
Copy link
Contributor

zougloub commented Jun 22, 2018

Setting the en_US.UTF-8 locale globally in the bashrc is not the proper solution. A more localized fix is needed. The closest I could think of was in the sct_launcher (no contamination as SCT is not localized). Or maybe detecting the situation in the installer and printing a big fat warning sign at the end, but nobody would process the information :)

@random1717
Copy link
Contributor Author

@zougloub normally, $LC_ALL is not set by default in macOS, which I guess wouldn't hurt to modify it. I agree with taking an action on sct_launcher, printing warning might not be enough IMO.

@random1717
Copy link
Contributor Author

Moving the solution to sct_launcher

@random1717 random1717 requested a review from zougloub June 22, 2018 16:12
zougloub
zougloub previously approved these changes Jun 22, 2018
Copy link
Contributor

@zougloub zougloub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but I don't have a Mac.

@random1717
Copy link
Contributor Author

Works on my MAC, @tanguyduval can you please verify?

Copy link
Member

@jcohenadad jcohenadad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the crash occurred during installation (tanguy, charley can you confirm?) i think we also need to take action inside install_sct, right?

@tanguyduval
Copy link
Contributor

tanguyduval commented Jun 23, 2018 via email

@random1717
Copy link
Contributor Author

@jcohenadad done
@tanguyduval Thanks for the tips
@zougloub or @perone Can you plz approve?

@random1717 random1717 requested a review from perone June 23, 2018 13:40
@random1717 random1717 added the installation category: install_sct or pip/setup.py label Jun 23, 2018
@zougloub zougloub dismissed their stale review June 23, 2018 19:42

Can't approve on something that modifies a user's general settings.

install_sct Outdated

# Fix for non-English Unicode systems on MAC
if [ -z ${LC_ALL} ]; then
echo "export LC_ALL=en_US.UTF-8" >> ~/.bash_profile
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i though we agreed to not modify the bash_profile? how about updating the env variable during install (to make TF happy), and also modify it in the launcher (to have it run during execution of TF-related functions)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done
I am not able to test, struggling with some problems related to pip ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be tested before merging, esp. on a laptop where the error UTF8-related occurs

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abtahizadeh changing local language to reproduce the error is extremely easy and takes 5s. Explanation here: microsoft/vscode#7301

@random1717 random1717 changed the title Local language support (LC_ALL) added to .bash_profile on macOS during the installation Local language support (LC_ALL) added to installation& launcher on macOS Jun 24, 2018
install_sct Outdated
@@ -242,11 +242,11 @@ if uname -a | grep -i darwin > /dev/null 2>&1; then

# Fix for non-English Unicode systems on MAC
if [ -z ${LC_ALL} ]; then
echo "export LC_ALL=en_US.UTF-8" >> ~/.bash_profile
export LC_ALL=en_US.UTF-8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not going to work with (t)csh.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it enter this if statement in Linux system? (If not, then disregard my comment about csh)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have an IF statement to check, we execute only on macOS:
if uname -a | grep -i darwin > /dev/null 2>&1; then

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry the previous lines were hidden by github. All good then 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jcohenadad plz approve

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abtahizadeh as mentioned in #1881 (comment), this PR needs to be tested before merging. You mentioned you had issues with pip that you will be fixing.

@random1717
Copy link
Contributor Author

@jcohenadad
Copy link
Member

jcohenadad commented Jul 3, 2018

tested ea6ef08 on an OSX Terminal configured with Japanese encoding. Installed passed successfully, however sct_testing behaves strangely (see messages) and got stuck at sct_get_centerline:

sct_testing -d 1

--
Spinal Cord Toolbox (feature/1880/ea6ef085316110fc0361c82525985b19af1dbcb6)
Running /Users/julien/code/sct/scripts/sct_testing.py -d 1

Downloading testing data...

Trying URL: https://osf.io/z8gaj/?action=download
Downloading 20180125_sct_testing_data.zip...
Status: 100%|##############################| 6.78M/6.78M [00:04<00:00, 1.63MB/s]

Check if folder already exists...
WARNING: Folder sct_testing_data already exists. Removing it...
rm -rf sct_testing_data

Unzip data to: /Users/julien

Remove temporary file...
Done!


Path to testing data: /Users/julien/sct_testing_data
Checking sct_analyze_lesion.........................[OK]
Checking sct_analyze_texture........................[OK]
Checking sct_apply_transfo..........................[OK]
Checking sct_compute_ernst_angle....................[OK]
Checking sct_compute_hausdorff_distance.............The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
[OK]
Checking sct_compute_mtr............................[OK]
Checking sct_compute_mscc...........................[OK]
Checking sct_compute_snr............................[OK]
Checking sct_concat_transfo.........................[OK]
Checking sct_convert................................[OK]
Checking sct_create_mask............................The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
[OK]
Checking sct_crop_image.............................[OK]
Checking sct_dice_coefficient.......................[OK]
Checking sct_deepseg_gm.............................[OK]
Checking sct_deepseg_sc.............................[OK]
Checking sct_detect_pmj.............................[OK]
Checking sct_dmri_compute_dti.......................[OK]
Checking sct_dmri_concat_bvals......................[OK]
Checking sct_dmri_concat_bvecs......................[OK]
Checking sct_dmri_create_noisemask..................[OK]
Checking sct_dmri_compute_bvalue....................[OK]
Checking sct_dmri_moco..............................[OK]
Checking sct_dmri_separate_b0_and_dwi...............[OK]
Checking sct_dmri_transpose_bvecs...................[OK]
Checking sct_extract_metric.........................[OK]
Checking sct_fmri_compute_tsnr......................[OK]
Checking sct_fmri_moco..............................[OK]
Checking sct_get_centerline.........................

UPDATE 2018-07-03 14:04: The issue with sct_testingis not specific to this PR and also appears on master. Issue opened here: #1898

@random1717
Copy link
Contributor Author

Tested on manufactured Sucheng (Chinese) macOS, installation successful,
got stuck at sct_deepseg_gm (!) when running sct_testing -d 1 ...

screen shot 2018-07-03 at 2 32 11 pm

@perone
Copy link
Contributor

perone commented Jul 3, 2018

@abtahizadeh is this Sucheng (Chinese) macOS running inside a VM or something like that ? The sct_deepseg_gm can be very slow if the VM is running without virtualization extensions. Did you check if the CPU is idle when the sct_deepseg_gm is stuck ? It might happen that it is just being slow.

@random1717
Copy link
Contributor Author

random1717 commented Jul 3, 2018

@perone Yes, VM, and I agree that might be because of not having enough resources, I also suspected that it might be because of running out of RAM. I am currently running another test to see if it works with 16G RAM and 4 CPUs.

@random1717
Copy link
Contributor Author

Test passed, the issue was related to insufficient memory/CPU, however, this bug still introduced: #1900

@random1717 random1717 merged commit e574232 into master Jul 4, 2018
@random1717 random1717 deleted the feature/1880 branch July 4, 2018 13:19
@jcohenadad jcohenadad added this to the v3.2.2 milestone Jul 7, 2018
jcohenadad pushed a commit that referenced this pull request Dec 18, 2019
Local language support (LC_ALL) added to installation& launcher on macOS

Former-commit-id: e574232
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
installation category: install_sct or pip/setup.py priority:HIGH
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants